I am making a basic 2d scrolling game and I am having a hard time with the gravity. I am using a concept of where in the main loop, the y-position of the sprite automatically increases until the sprite collides with another sprite. When the collision checks one sprite it seems to work. When I try to do a check of multiple floor sprites, it doesn't create the gravity.
d=0
do
inc d
if d>100 then exit
if sprite exist(5000+d) and sprite exist(11)
if sprite collision(11,5000+d)=0 and sprite hit(11,5000+d)=0 then inc ypos(1): exit
endif
loop
sprite 11 = the human controlled player
sprites 5001-5500 = possible floor sprites
ypos(1) = y position for the human controlled player
Even this way isn't working:
for d=1 to 100
if sprite exist(5000+d) and sprite exist(11)
if sprite collision(5000+d,11)=0 then inc ypos(1)
endif
next d
When I do it like this, he falls through it
Help please?!? ps embarrased because I solved this before but I have some time now and I will back up all solutions and never let up this time!!!!
- Infinity is Simplicity -