I've been trying a zelda game for the competition
However when I collide my zelda into a wall, he is stuck. How do I get to be able to back away. I have tried to do like the example does, but that does not help.
Here's the code so far
rem +++++++++++++++++++++++++++++++++++++
rem +++++++++ zelda game ++++++++++++++++
rem +++++++++++++++++++++++++++++++++++++
hide mouse
Rem intro screen
hide mouse
rem screen
Load bitmap "intro screen.bmp"
rem buttons
Load image "newgame.bmp",1
Load image "loadgame.bmp",2
Load image "sword.bmp",2000
Sprite 1,280,300,1
Sprite 2,280,350,2
Sprite 2000,0,0,2000
Do
Rem mouse cursor
Sprite 2000,mousex(),mousey(),2000
Rem click on the new game button
If sprite collision(1,2000)=1
If mouseclick()=1
Goto NewGame
endif
endif
Rem click on the load game button
If sprite collision(2,2000)=1
If mouseclick()=1
CLS
delete image 1
delete image 2
Delete sprite 1
Delete sprite 2
Delete image 2000
Delete sprite 2000
end
endif
endif
Loop
NewGame:
Rem clear the screen
CLS
delete image 1
delete image 2
Delete sprite 1
Delete sprite 2
Goto Level1
Return
Rem ++++++++++++++++++++++++++++++++++++++++++++
Rem Level 1 - town and cliff zone
Rem ++++++++++++++++++++++++++++++++++++++++++++
Level1:
Make matrix 1,3225.6,1814.4,4,3
x#=0
y#=0
z#=0
Position matrix 1,x#,y#,z#
Position camera 500,500,0
Point camera 500,0,0
rem world texture
Load image "screen 1.psd",1
Prepare matrix texture 1,1,1,1
rem walls
Load image "floor.bmp",3
Rem character
Load image "zelda2.bmp",1999
Sprite 1999,320,240,1999
Do
rem properties for collisions
oldx#=x#
oldz#=z#
rem mouse
Sprite 2000,mousex(),mousey(),2000
Position matrix 1,x#,y#,z#
rem wall
sprite 1,20-(x#/2),20-(z#/2),3
rem movement
rem down left
If leftkey()=1 and downkey()=1
x#=x#+10
z#=z#+10
endif
rem left up
If leftkey()=1 and upkey()=1
x#=x#+10
z#=z#-10
endif
rem right down
If rightkey()=1 and downkey()=1
x#=x#-10
z#=z#+10
endif
rem right up
If rightkey()=1 and upkey()=1
x#=x#-10
z#=z#-10
endif
rem left, right, down, up
If leftkey()=1 then x#=x#+10
If rightkey()=1 then x#=x#-10
If downkey()=1 then z#=z#+10
If upkey()=1 then z#=z#-10
rem collision - stops character when collision occurs
rem - this is the problem
` sprite 1 is the wall number 1
` sprite 1999 is the character
if sprite collision(1,1999)>0
x#=oldx#
z#=oldz#
endif
Loop
My computer melts regulary - perhaps it likes being fondue