Thanks everyone, sorry for the late replies(real life..)
I've been trying to figure out the collision between my two rectangle. I don't quite understand it yet with what you guys provided me. As for increasing gravity, well gonna add it after I can actually touch the ground and move right and left lol(same goes for jumping).
So let's start with my collision...
I'm not quite sure why my piece of code won't let me modify gravity..?
Not Quite sure how to design my level should I make a function which draws all the masked SOLID background that would collide with my player's rectangle mask?
*shake his head and goes take an advil* xD
I've been trying to figure out the collision between my two rectangle. I don't quite understand it yet with what you guys provided me. As for increasing gravity, well gonna add it after I can actually touch the ground and move right and left lol(same goes for jumping).
So let's start with my collision...
I'm not quite sure why my piece of code won't let me modify gravity..?
SuperStrict Graphics 800,600,0 '******************************************************************************************** Global GameRoom:Int =0 Global GameExit:Int =False ResetCollisions() Local P1:TPlayer=New TPlayer; P1.Create(10.0 ,10.0 ) While Not GameExit=True If(KeyHit(KEY_ESCAPE))Or(AppTerminate())Then GameExit=True P1.Updates() MakeSolid(0,560,800,25) Flip 1 Cls Wend End Type TPlayer Field health:Int, mana:Int Field xpos:Float, ypos:Float Field maskw:Int=70, maskh:Int=120 Field gravity:Float=1.0 Field jump:Int=False Method Create( xstart:Float, ystart:Float ) xpos=xstart ypos=ystart End Method Method Updates() If KeyDown(KEY_UP) Then ypos :- 5.0 If KeyDown(KEY_DOWN) Then ypos :+ 5.0 If KeyDown(KEY_LEFT) Then xpos :- 5.0 If KeyDown(KEY_RIGHT) Then xpos :+ 5.0 If KeyHit(KEY_SPACE) Then jump = True ypos :+ gravity Self.Drawing() End Method Method Drawing() DrawRect xpos,ypos,maskw,maskh CollideRect xpos,ypos,maskw,maskh,0,1 End Method End Type Function MakeSolid( x:Int, y:Int, w:Int, h:Int ) DrawRect(x,y,w,h) If(CollideRect(x,y,w,h,1,0))Then P1.gravity=0 EndIf End Function
Not Quite sure how to design my level should I make a function which draws all the masked SOLID background that would collide with my player's rectangle mask?
*shake his head and goes take an advil* xD