Forum Replies Created
-
AuthorPosts
-
Ok, I emptied out my paypal into the donation. Only 10.50$ was on it though. I will check soon if I can put more on it and give more.
I think the paypal setting for the donations is set to only donate 7 dollars at a time.
You mean like a mental picture?
I can imagine a image in my mind and sort of vagualy see it. Not much details though. I am not trained as a painter or such.
Nice. The movement feels good.
I think I now also figured out how to use assets. I have not used those before in Monkey2.
I hope this can help a bit. It is not a short piece of code but I did try to add comment.
Monkey123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222#Import "<std>"#Import "<mojo>"Using std..Using mojo..Class mapField map:Int[][]Field mapwidth:IntField mapheight:IntField tilewidth:IntField tileheight:IntField screenwidth:IntField screenheight:IntMethod New(screenwidth:Int,screenheight:Int)Self.screenwidth = screenwidthSelf.screenheight = screenheightsetlevel1()End MethodMethod setlevel1()map = New Int[][] (New Int[]( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ),New Int[]( 2, 0, 0, 0, 0, 0, 0, 0, 0, 2 ),New Int[]( 2, 0, 0, 0, 0, 0, 0, 0, 0, 2 ),New Int[]( 2, 0, 0, 0, 0, 0, 1, 1, 1, 2 ),New Int[]( 2, 0, 0, 0, 0, 0, 0, 0, 0, 2 ),New Int[]( 2, 0, 0, 0, 0, 0, 0, 0, 0, 2 ),New Int[]( 2, 1, 1, 1, 1, 0, 0, 0, 0, 2 ),New Int[]( 2, 0, 0, 0, 0, 0, 0, 0, 0, 2 ),New Int[]( 2, 1, 1, 1, 1, 0, 0, 0, 0, 2 ),New Int[]( 2, 0, 0, 0, 0, 0, 0, 0, 0, 2 ),New Int[]( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ) )mapwidth = map[0].Lengthmapheight = map.LengthEnd MethodEnd ClassClass player' player x and yField px:FloatField py:Float' player widht and heigthField pw:IntField ph:Int' How fast left move and rightField horspeed:Int=3' gravity variablesField incy:Float=0Field falling:Bool=FalseField jumping:Bool=FalseMethod New(x:Int,y:Int,w:Int,h:Int)px = xpy = ypw = wph = hEnd Method' Player controlsMethod controls()' Left and right movement (horspeed is the speed left and right)For Local i:Int=0 Until horspeed' If we are jumping or falling then we only want to be' stopped by tile number 2If jumping=True Or falling = TrueIf Keyboard.KeyDown(Key.Right) And playertc(1,0,2) = Falsepx += 1End IfIf Keyboard.KeyDown(Key.Left) And playertc(-1,0,2) = Falsepx -= 1End IfElse 'Here we are not jumping or falling so we want the' collision with movement left and right to stop when' hitting any tile number.If Keyboard.KeyDown(Key.Right) And playertc(1,0,99) = Falsepx += 1End IfIf Keyboard.KeyDown(Key.Left) And playertc(-1,0,99) = Falsepx -= 1End IfEnd ifNext' Player jump when press space. We are not jumping or falling right now.If jumping=False And falling=False And Keyboard.KeyHit(Key.Space)jumping=Trueincy = 5End IfEnd Method'' This method takes care of the falling and jumping for the playerMethod gravity()' First check if we have something beneach us' and if not then fall down. Be sure we are' not falling or jumping right now.If falling = False And jumping=FalseIf playertc(0,1,99) = Falsefalling=Trueincy = 0End IfEnd If' Code for when jumping state = trueIf jumping = Trueincy-=.1For Local i:Int = 0 Until Ceil(incy)' If we are not jumping into a solid non jump through tile' then keep jumpingIf playertc(0,-1,2) = Falsepy -= 1Else 'if we touched a tile we can not jump through then init' fallingincy=0jumping = Falsefalling = TrueExitEnd IfNext' If we run out of jump force(incy) then set to fallingIf incy<=0 Thenjumping=falsefalling=Trueincy=0End IfEnd If' Code for when the falling state is trueIf falling=True Thenincy+=.05For Local i:Int=0 Until Ceil(incy)' If we have nothing beneath us or are not inside anything' then keep fallingIf playertc(0,1,99) = False Or playertc(0,0,99) = Truepy+=1Else 'if we hit solid bottomfalling = FalseExitEnd IfNextEnd IfEnd Method' Player versus tile collision (uses offsets x1 and y1)' Here we check if the player is inside any nearby tile around him.' x1 and y1 is the offset. This way we can check the player position' and a little bit around him.Method playertc:Bool(x1:Int=0,y1:Int=0,tile:Int)Local cx:Int = (px + x1) / mymap.tilewidthLocal cy:Int = (py + y1) / mymap.tileheightFor Local y2:Int=cy-1 Until cy+2For Local x2:Int=cx-1 Until cx+2If x2>=0 And x2<mymap.mapwidth And y2>=0 And y2<mymap.mapheight' If we check for tile = 99 then we check for any tile above value 0If tile=99 ThenIf mymap.map[y2][x2] > 0If rectsoverlap(px+x1,py+y1,pw,ph,x2*mymap.tilewidth,y2*mymap.tileheight,mymap.tilewidth,mymap.tileheight) = TrueReturn TrueEnd IfEnd IfElse 'Here we check the map we are inside of with the inputted tile numberIf mymap.map[y2][x2] = tileIf rectsoverlap(px+x1,py+y1,pw,ph,x2*mymap.tilewidth,y2*mymap.tileheight,mymap.tilewidth,mymap.tileheight) = TrueReturn TrueEnd IfEnd IfEnd IfEnd IfNextNextReturn FalseEnd Method' Draw the player on the screenMethod draw(canvas:Canvas)canvas.Color = Color.Bluecanvas.DrawRect(px,py,pw,ph)End Method' Helper functionFunction rectsoverlap:Bool(x1:Int, y1:Int, w1:Int, h1:Int, x2:Int, y2:Int, w2:Int, h2:Int)If x1 >= (x2 + w2) Or (x1 + w1) <= x2 Then Return FalseIf y1 >= (y2 + h2) Or (y1 + h1) <= y2 Then Return FalseReturn TrueEnd FunctionEnd ClassGlobal myplayer:playerGlobal mymap:mapClass MyWindow Extends WindowMethod New()' Set The title of the window...Title="Tilemap example Array of Arrays....."mymap = New map(Width,Height)mymap.tilewidth = Width/mymap.map[0].Lengthmymap.tileheight = Height/mymap.map.Lengthmyplayer = New player(4*mymap.tilewidth,4*mymap.tileheight,mymap.tilewidth/2,mymap.tileheight/2)End MethodMethod OnRender( canvas:Canvas ) OverrideApp.RequestRender() ' Activate this method' Clear with black colorcanvas.Clear(Color.Black)canvas.Color = Color.White'Draw the tilemapFor Local y:Int=0 Until mymap.map.LengthFor Local x:Int=0 Until mymap.map[0].LengthIf mymap.map[y][x] > 0canvas.DrawRect(x*mymap.tilewidth,y*mymap.tileheight,mymap.tilewidth,mymap.tileheight)End IfNextNext' Do the player controls and drawmyplayer.controls()myplayer.gravity()myplayer.draw(canvas)' if key escape then quitIf Keyboard.KeyReleased(Key.Escape) Then App.Terminate()End MethodEnd ClassFunction Main()New AppInstanceNew MyWindowApp.Run()End FunctionI am watching soccer atm so no time to prepare some code. But the way I always look at things like this is by thinking in states.
When the playing is in his jump and going up I set a new variable called jumpingup=true. Another variable like jumpingdown=true if he is falling down. With variables like this I can see when to check for or not check for collision. (if jumpingup=true and myuptilecollision() then …)
I will try to remember to look after the match and make some code.
Steam has this whole community system around each of its products. Even things like streaming. It would be nice to see that being used.
I have no experience with how difficult it would be but I also hope things like the the desktop C++ and emscripten things would be installed/updated automagically.
I just started a remake project. It wil take longer then a month this one. I am remaking a old Amiga game from 1987 called “Fire Power” I have been spending a couple of days already on the graphics and still need to do a lot of them. Every graphic is going to be code. Am at 1000 lines now.
I wil open a project thread here when I am further in the project.
Am I right that joystick always works the same when compiled for the browser? I bought one and want to start adding this to my games.
Ok, the person solved the problem. He changed the dots in the filename to underscore and then it compiled and ran without the error. It sort of looks like it is not possible with some code to have more . characters in the filename other then in front of the extension.
Happy new year!
May there be lots of lines of fine code and few bugs..
He seems not to be getting the confirmation emails from this site registration. As far as I can tell he installed the mingw from the links on this site.
We are communicating on here (thread) : (you might need to select view from youtube )
The person registered here but has not gotten the email yet. He posted a more complete error report on the youtube thread. Below :
Monkey12345678910111213141516171819202122232425262728293031323334353637383940414243Mx2cc version 1.1.08*** Building app 'D:/monkey2p/CivClone 0.75.monkey2' ***Parsing...Semanting...Translating...Compiling...Build error: System command 'g++ -c -std=c++11 -m32 -D_WIN32_WINNT=0x0603 -I"d:/Monkey2-v1.1.08/modules/" -I"d:/Monkey2-v1.1.08/modules/monkey/native" -I"D:/monkey2p/" -I"d:/Monkey2-v1.1.08/modules/freetype/freetype-2.6.3/include/" -I"d:/Monkey2-v1.1.08/modules/openal/openal-soft/include/" -I"d:/Monkey2-v1.1.08/modules/gles20/angle/include/" -I"d:/Monkey2-v1.1.08/modules/sdl2/SDL/include/" -o "D:/monkey2p/CivClone 0.75.buildv1.1.08/windows_debug/build/CivClone_040.75_0CivClone_040.75.cpp.o" "D:/monkey2p/CivClone 0.75.buildv1.1.08/windows_debug/src/CivClone_40.75_CivClone_40.75.cpp"' failed.g++ -c -std=c++11 -m32 -D_WIN32_WINNT=0x0603 -I"d:/Monkey2-v1.1.08/modules/" -I"d:/Monkey2-v1.1.08/modules/monkey/native" -I"D:/monkey2p/" -I"d:/Monkey2-v1.1.08/modules/freetype/freetype-2.6.3/include/" -I"d:/Monkey2-v1.1.08/modules/openal/openal-soft/include/" -I"d:/Monkey2-v1.1.08/modules/gles20/angle/include/" -I"d:/Monkey2-v1.1.08/modules/sdl2/SDL/include/" -o "D:/monkey2p/CivClone 0.75.buildv1.1.08/windows_debug/build/CivClone_040.75_0CivClone_040.75.cpp.o" "D:/monkey2p/CivClone 0.75.buildv1.1.08/windows_debug/src/CivClone_40.75_CivClone_40.75.cpp"In file included from D:/monkey2p/CivClone 0.75.buildv1.1.08/windows_debug/src/CivClone_40.75_CivClone_40.75.cpp:2:0:D:/monkey2p/CivClone 0.75.buildv1.1.08/windows_debug/include/CivClone_40.75_CivClone_40.75.h:2:24: warning: extra tokens at end of #ifndef directive#ifndef MX2_CIVCLONE_40.75_CIVCLONE_40.75_H^~~~~~~~~~~~~~~~~~~~D:/monkey2p/CivClone 0.75.buildv1.1.08/windows_debug/include/CivClone_40.75_CivClone_40.75.h:3:24: warning: ISO C++11 requires whitespace after the macro name#define MX2_CIVCLONE_40.75_CIVCLONE_40.75_H^~~~~~~~~~~~~~~~~~~~<-------------------------the end---------------------->d:/Monkey2-v1.1.08/modules/monkey/native/bbobject.h: In instantiation of 'void bbGCVar<T>::enqueue() [with T = t_std_collections_List_1Tt_default_unit_cargo_2]':d:/Monkey2-v1.1.08/modules/monkey/native/bbobject.h:116:10: required from 'bbGCVar<T>& bbGCVar<T>::operator=(T*) [with T = t_std_collections_List_1Tt_default_unit_cargo_2]'D:/monkey2p/CivClone 0.75.buildv1.1.08/windows_debug/src/CivClone_40.75_CivClone_40.75.cpp:9445:76: required from hered:/Monkey2-v1.1.08/modules/monkey/native/bbobject.h:100:18: error: cannot dynamic_cast '((bbGCVar<t_std_collections_List_1Tt_default_unit_cargo_2>*)this)->bbGCVar<t_std_collections_List_1Tt_default_unit_cargo_2>::_ptr' (of type 'struct t_std_collections_List_1Tt_default_unit_cargo_2*') to type 'struct bbGCNode*' (source is a pointer to incomplete type)*** Fatal mx2cc error ***Internal mx2cc build errorOther code he tried from my github does compile and work for him. I see references to code I made in the error log and I am thinking it might have to do with a newer c++ compiler? On my old 1.1.08 install it just works…
Mark added a banana that showed how to create a quad mesh. I asked for a example back then. I made several more examples that I have on my monkey2-3d github.
https://github.com/Pakz001/Monkey2-3D
So, what can you do with these websockets and games? Is it for multiplayer game like quake in the webbrowser and such?
-
AuthorPosts