I've got an issue with jumping in my platformer. Basically, you can jump, and you go up, the slow down, then come back down, and stop, not on the ground, but at a set position.
How do I make it stop on the ground, wherever the ground is, because the ground is an image.
Code i'm using:
Rem Project: My First Platformer
Rem Created: 03-Mar-07 1:35:43 PM
Rem ***** Main Source File *****
fps#=screen fps()
` Load the game image for ground, and make a basic player object, a sphere
LOAD IMAGE "media\ground1.bmp",1
LOAD IMAGE "media\arrow.bmp",2
LOAD IMAGE "media\diagonal.bmp",3
MAKE OBJECT SPHERE 3,70
COLOR OBJECT 3,RGB(255,0,0)
` Position the temporary player sphere now
POSITION OBJECT 3,200,200,100
` Camera code
Position Camera Object Position X(3),Object Position Y(3)+800,Object Position Z(3)
Point Camera Object Position X(3),Object Position Y(3),Object Position Z(3)
DO
` Movement Code
IF KEYSTATE(30)=1 THEN MOVE OBJECT LEFT 3,.9
IF KEYSTATE(32)=1 THEN MOVE OBJECT RIGHT 3,.9
` Print the FPS on the screen
TEXT 0,0,"FPS: "+str$(fps#)
` Create a basic floor for our game
PASTE IMAGE 1,168,258,120
PASTE IMAGE 1,136,258,120
PASTE IMAGE 1,104,258,120
PASTE IMAGE 1,72,258,120
PASTE IMAGE 1,40,258,120
PASTE IMAGE 1,8,258,120
PASTE IMAGE 1,-24,258,120
PASTE IMAGE 1,200,258,120
PASTE IMAGE 1,232,258,120
PASTE IMAGE 1,264,258,120
PASTE IMAGE 1,296,258,120
PASTE IMAGE 1,328,258,120
` Arrow Direction Sign 1
PASTE IMAGE 2,300,100,120
`Diagonal Hill 1
PASTE IMAGE 3,268,218,120
` Jumping Code
IF SPACEKEY()=1 AND JUMPING#=0 THEN JUMP#=1
`JUMP Variable Definition
IF JUMP#=1
GROUND#=OBJECT POSITION Z(3)
JUMP_SPEED#=.5
JUMPING#=1
JUMP#=0
ENDIF
`Jumping
IF JUMPING#=1
DEC JUMP_SPEED#,.001
POSITION OBJECT 3,OBJECT POSITION X(3),OBJECT POSITION Y(3), OBJECT POSITION Z(3)+JUMP_SPEED#
IF OBJECT POSITION Z(3)<=GROUND# THEN JUMPING#=0
ENDIF
LOOP
Media attached.
Need web design help with PHP or XHTML? E-mail me!
http://veron.sitesled.com Visit Veron! Free games, programs and applications! Made in DBPRO, FPSC, and C++!