Well, I made a simple 2D game where you have to avoid an enemy, jump up ,and touch a goal several times to win. Now, I'm trying to add the ability to shoot a porjectile to kill the enemy, but when the projectile 'goes out', the enemy can walk right through it unharmed...
Here's the code snippet:
print "Save The Princess!"
print "Version 1.0/Release"
print "-"
print "The First Real-Time"
print "Action Game From"
print "Online Adventures"
print "-"
print "Programmed By:"
print "Jake O'Donnell"
wait 3000
cls
print "Object: You must rescue the Princess by jumping up"
print " and touching her five times on the side or"
print " ten times from the bottom, all the while"
print " avoiding the Demon Lord Hargon, who is"
print " trying to stop you."
print " "
print " Press Any Key To Start The Game."
suspend for key
cls
randomize timer
sprite1x = 100
sprite1y = 380
sprite2x = 639
sprite2y = 380
sprite3x = 400
sprite3y = 280
oldsp1x = 100
oldsp1y = 380
oldsp2x = 639
oldsp2y = 380
oldsp3x = 400
oldsp3y = 280
prin = 0
load bitmap "DLKnight.bmp",1
get image 1,0,0,50,50
sprite 1,sprite1x,sprite1y,1
load bitmap "DLHargon.bmp",2
get image 2,0,0,50,50
sprite 2,sprite2x,sprite2y,2
load bitmap "DLPrincess.bmp",3
get image 3,0,0,50,50
sprite 3,sprite3x,sprite3y,3
a:
sprite4x = sprite1x + 50
sprite4y = sprite1y
print "crap";prin;"crap"
if prin > 15 then goto End else
oldsp1x = sprite1x
oldsp1y = sprite1y
oldsp2x = sprite2x
oldsp2y = sprite2y
oldsp3x = sprite3x
oldsp3y = sprite3y
if sprite1x 640 then sprite1x = 639
if sprite3x 640 then sprite3x = 590
sprite2x = sprite2x - 5
if sprite2x 379 then goto b else goto d
d:
sprite1y = sprite1y + 5
if sprite1y 0 then ink 0,rgb(255,255,255) else ink rgb(255,255,255),0
rem Check for collision and block new position
if sprite collision(1,2)>0
sprite1x=oldsp1x
sprite1y=oldsp1y
sprite2x=oldsp2x
sprite2y=oldsp2y
sprite3x=oldsp3x
sprite3y=oldsp3y
sprite 1,sprite1x,sprite1y,1
sprite 2,sprite2x,sprite2y,2
sprite 3,sprite3x,sprite3y,3
goto Over
endif
rem Check for initial impact
if sprite hit(1,3)>0 then ink 0,rgb(255,255,255) else ink rgb(255,255,255),0
rem Check for collision and block new position
if sprite collision(1,3)>0 then goto s else goto u
s:
sprite1x=oldsp1x
sprite1y=oldsp1y
sprite2x=oldsp2x
sprite2y=oldsp2y
sprite3x=oldsp3x
sprite3y=oldsp3y
sprite 1,sprite1x,sprite1y,1
sprite 2,sprite2x,sprite2y,2
sprite 3,sprite3x,sprite3y,3
t:
total = RND(399)+1
if sprite3x > 589 then sprite3x = 588
if total 125 then sprite3x = sprite3x + total else sprite3x = sprite3x - total
prin = prin + 1
u:
rem Check for initial impact
if sprite hit(2,3)>0 then ink 0,rgb(255,255,255) else ink rgb(255,255,255),0
rem Check for collision and block new position
if sprite collision(2,3)>0
sprite1x=oldsp1x
sprite1y=oldsp1y
sprite2x=oldsp2x
sprite2y=oldsp2y
sprite3x=oldsp3x
sprite3y=oldsp3y
sprite 1,sprite1x,sprite1y,1
sprite 2,sprite2x,sprite2y,2
sprite 3,sprite3x,sprite3y,3
print "Sprite Life"
endif
sync
goto a
c:
oldsp1y = sprite1y
wait 10
sprite1y = sprite1y + 10
if sprite1y > 379 then goto b
if upkey()=1 then sprite1y = sprite1y
rem if downkey()=1 then sprite1y = sprite1y + 5
if leftkey()=1 then sprite1x = sprite1x - 5
if rightkey()=1 then sprite1x = sprite1x + 5
rem draw the sprite at the new position
sprite 1,sprite1x,sprite1y,1
sprite 2,sprite2x,sprite2y,2
sprite 3,sprite3x,sprite3y,3
rem Check for initial impact
if sprite hit(1,2)>0 then ink 0,rgb(255,255,255) else ink rgb(255,255,255),0
rem Check for collision and block new position
if sprite collision(1,2)>0
sprite1x=oldsp1x
sprite1y=oldsp1y
sprite2x=oldsp2x
sprite2y=oldsp2y
sprite3x=oldsp3x
sprite3y=oldsp3y
sprite 1,sprite1x,sprite1y,1
sprite 2,sprite2x,sprite2y,2
sprite 3,sprite3x,sprite3y,3
goto Over
endif
rem Check for initial impact
if sprite hit(1,3)>0 then ink 0,rgb(255,255,255) else ink rgb(255,255,255),0
rem Check for collision and block new position
if sprite collision(1,3)>0 then goto s2 else goto u2
s2:
sprite1x=oldsp1x
sprite1y=oldsp1y
sprite2x=oldsp2x
sprite2y=oldsp2y
sprite3x=oldsp3x
sprite3y=oldsp3y
sprite 1,sprite1x,sprite1y,1
sprite 2,sprite2x,sprite2y,2
sprite 3,sprite3x,sprite3y,3
t2:
total = RND(399)+1
if total 125 then sprite3x = sprite3x + total else sprite3x = sprite3x - total
prin = prin + 1
u2:
rem Check for initial impact
if sprite hit(2,3)>0 then ink 0,rgb(255,255,255) else ink rgb(255,255,255),0
rem Check for collision and block new position
if sprite collision(2,3)>0
sprite1x=oldsp1x
sprite1y=oldsp1y
sprite2x=oldsp2x
sprite2y=oldsp2y
sprite3x=oldsp3x
sprite3y=oldsp3y
sprite 1,sprite1x,sprite1y,1
sprite 2,sprite2x,sprite2y,2
sprite 3,sprite3x,sprite3y,3
print "Sprite Life"
endif
rem Check for initial impact
if sprite hit(2,4)>0 then ink 0,rgb(255,255,255) else ink rgb(255,255,255),0
rem Check for collision and block new position
if sprite collision(2,4)>0
sprite1x=oldsp1x
sprite1y=oldsp1y
sprite3x=oldsp3x
sprite3y=oldsp3y
sprite 1,sprite1x,sprite1y,1
sprite 3,sprite3x,sprite3y,3
delete sprite 2
endif
if sprite1y > 380 then goto a else goto c
End:
cls
load bitmap "wbs.bmp"
print "You saved the Princess!"
print "Press any key to end the game."
suspend for key
cls
end
Over:
cls
load bitmap "wbs.bmp"
print "You failed to save the Princess..."
print "Press any key to end the game."
suspend for key
cls
stop
end
Fire:
sprite 4,sprite4x,sprite4y,3
sprite4x = sprite4x + 3
wait 1
sprite4x = sprite4x + 3
wait 1
sprite4x = sprite4x + 6
wait 1
sprite4x = sprite4x + 6
wait 1
sprite4x = sprite4x + 9
wait 1
sprite4x = sprite4x + 9
wait 1
sprite4x = sprite4x + 13
wait 1
sprite4x = sprite4x + 13
wait 1
sprite4x = sprite4x + 23
wait 1
sprite4x = sprite4x + 23
wait 1
sprite4x = sprite4x + 33
wait 1
sprite4x = sprite4x + 33
wait 1
sprite4x = sprite4x + 38
wait 1
sprite4x = sprite4x + 38
wait 1
sprite4x = sprite4x + 43
wait 1
sprite4x = sprite4x + 43
wait 1
sprite4x = sprite4x + 46
wait 1
sprite4x = sprite4x + 46
goto a
Any help would REALLY be appreciated.
Thanks!
-Ya know how much I hate 'Stack Overload Error's?-
Thhhhhhhhhhhiiiiiiiisssssssssssss muuuuuuuuccchhh!