Ahh absolutely fantastic, thanks! I think I misunderstood the documentation for DBP.
That's great though... I just need to start getting an understanding of map-making now
I added a bit more stuff to my code, added a sense of velocity when jumping, though if I decrease the movement speed below 0.5 the character just stops in midair or won't move anymore.
Is it because i'm mixing floats with integers?
`setup
sync on
sync rate 60
set display mode 640,480,32
hide mouse
backdrop off
autocam off
set dir "media\"
load image "mainchar.png", 1
sprite 1, 32, 64, 1
`variables
global health# = 100.0
global lives = 3
global continue = 1
global score = 0
startCount = 0
type MainCharacter
xpos as integer
ypos as integer
xspeed as float
yspeed as float
direction as integer
animation as integer
endtype
rhea as MainCharacter
`startupstuff for rhea
rhea.xpos = 320
rhea.ypos = 240
rhea.xspeed = 0.0
rhea.yspeed = 0.0
rhea.direction = 1
rhea.animation = 0
`main loop
DO
cls
ink RGB(255,255,255),0
text 10,10, "Score: "+ str$(score#)
text 10,25, "Lives: "+ str$(lives)
text 10,40, "XPOS: "+ str$(rhea.xpos)
text 10,55, "YPOS: "+ str$(rhea.ypos)
gosub xmovement
gosub ymovement
sprite 1, rhea.xpos, rhea.ypos, 1
SYNC
LOOP
END
`main loop end
`subfunctions
xmovement:
`basic bits
rhea.ypos = (rhea.ypos)+rhea.yspeed
rhea.xpos = (rhea.xpos)+rhea.xspeed
`movementstuff
if rightkey() = 1 then rhea.direction = 1
if leftkey() = 1 then rhea.direction = 2
if leftkey() = 0 and rightkey() = 0 then rhea.direction = 0
select rhea.direction
case 0
if jumpNumber = 0
if rhea.xspeed > 0.0
repeat
dec rhea.xspeed, 0.5
until rhea.xspeed = 0.0
endif
if rhea.xspeed < 0.0
repeat
inc rhea.xspeed, 0.5
until rhea.xspeed = 0.0
endif
endif
endcase
case 1
inc rhea.xspeed, 0.5
endcase
case 2
dec rhea.xspeed, 0.5
endcase
endselect
if rhea.xspeed > 3.0 then rhea.xspeed = 3.0
if rhea.xspeed < -3.0 then rhea.xspeed = -3.0
if rhea.xpos > (640-32) then rhea.xpos = (640-32)
if rhea.xpos < 0 then rhea.xpos = 0
return
ymovement:
`gravity
if collision = 0 then inc rhea.yspeed, 0.5
if collision = 1 then rhea.yspeed = 0.0
if rhea.ypos > (480-64)
rhea.ypos = (480-64)
collision = 1
jumpNumber = 0
endif
`jumping
if shiftkey() = 1 and jumpNumber = 0
jumpNumber = 1
rhea.yspeed = -8
collision = 0
endif
return
`functions
also replaced rhea with a fancy block for now