so my friend and I have been learning DarkBASIC for literally almost a week straight. We decided to start working on small silly projects, to get some experience under our belts. We have code we're working on right now to get collision working, and we have the collision check working, but every time our stick man sprite gets close to the platform sprite, it stops, but refuses to move. That tells us the collision IS working, but we can't get the sprite to start moving again.
Now, I've tried writing some code to counter the whole stopping and not moving thing, but i'm becoming stumped. Here's our current code:
type system
x as integer = 0
y as integer = 0
imagedata as integer = 0
spritedata as integer = 0
imagetext as integer = 1
collision as integer = 0
endtype
global bground as system
global human as system
global platform1 as system
bground.imagedata = 2
platform1.imagedata = 3
platform1.spritedata = 3
platform1.x = 400
platform1.y = 350
human.x = 240
human.y = 290
human.imagedata = 1
human.spritedata = 1
sync rate 60
sync on
load image "media\human2.bmp", human.imagedata, 1
load image "media\mushy.bmp", bground.imagedata, 1
load image "media\platform1.bmp", platform1.imagedata, 1
sprite human.spritedata, human.x, human.y, human.imagedata
sprite platform1.spritedata, platform1.x, platform1.y, platform1.imagedata
do
drawobjects()
playermovement()
collisioncheck()
sync
loop
end
function drawobjects()
paste image 2,0,0
sprite human.spritedata, human.x,human.y, human.imagedata
sprite platform1.spritedata, platform1.x, platform1.y, platform1.imagedata,
endfunction
function playermovement()
if leftkey() = 1
dec human.x, 5
endif
if rightkey() = 1
inc human.x, 5
endif
if upkey() = 1
dec human.y, 5
endif
if downkey() = 1
inc human.y, 5
endif
endfunction
function collisioncheck()
collision = sprite collision(human.spritedata, platform1.spritedata)
endfunction