Im making a minecraft-like game,but i need help to make a gravity system,that includes:
-Falling down
-Jump
(optional:-Blocks that can fall)
Please help me,hey and if u want to team,pm me.
Offline
this is for the moving sprite
when gf clicked forever if (not touching the ground) fall end if (touching ground and up pressed) jump end endand this is for the other one
when gf clicked forever if(touching move sprite) wait(a bit) fall end endhope this helps
Last edited by dvd4 (2012-09-08 14:25:51)
Offline
Here is a basic simulation of jumping and gravity (using acceleration). For block physics (falling blocks), it is very dependent on how you're rendering the blocks. Are you re-drawing them each frame from an array or do you stamp them once in the beginning and edit them when needed? Either way, I can tell you right now that block-physics will be quite advanced.
when gf clicked set [y-vel v] to (0) forever change [y-vel v] by (-1) change y by (y-vel) if<touching [ground v]?> change y by (1) if<touching [ground v]?> change y by (1) if<touching [ground v]?> change y by (1) end set [y-vel v] to (0) else change y by (y-vel) if<(y-vel) > (-3)> change [y-vel v] by (-1) end
Offline
dvd4 wrote:
this is for the moving sprite
when gf clicked forever if (not touching the ground) fall end if (touching ground and up pressed) jump end endand this is for the other onewhen gf clicked forever if(touching move sprite) wait(a bit) fall end endhope this helps
Dude,where i find the (touching ground and up pressed) thing?And about the red jump and fall thingy?
Offline
DjPenguin68 wrote:
dvd4 wrote:
this is for the moving sprite
when gf clicked forever if <not<touching [the ground v]?>> fall end if<<touching [ground v]?> and <key [up arrow v] pressed?>> jump end endand this is for the other onewhen gf clicked forever if<touching [move sprite v]?> wait (a bit) secs fall end endhope this helpsDude,where i find the (touching ground and up pressed) thing?And about the red jump and fall thingy?
I fixed his blocks; they should be more recognizable now
The red blocks are abbreviations for whatever code you have that currently does the indicated action. Where "jump" is, for instance, you could put this:
change y by (50) repeat until <touching [ground v]?> change y by (-5) end
Last edited by MoreGamesNow (2012-09-17 17:07:28)
Offline
when gf clicked set [gravity v] to (-.4) set [velocity v] to (0) forever if <touching [ground v]?> set [velocity v] to (0) else change [velocity v] by (gravity) change y by (velocity)This works well in most circumstances and isn't a tough script to tamper with.
Last edited by bullelk12 (2012-09-17 22:08:10)
Offline