Hello all,
I've been trying a number of different ways to get the character to shoot in the direction it's facing while walking. I don't know how to go about it, im stuck. Here is the code that i have so far along with the image. Any help would be great.
set display mode 1024,768,32
color backdrop rgb(0,0,0)
sync rate 0
sync on
sync rate 50
load image "media\player\skeleton_walk_001.png",1,1
create animated sprite 1, "media\player\skeleton_walk_001.png",24,3,1
sprite 1,0,0,1
offset sprite 1, sprite width(1) / 2, sprite height(1) / 2
sprite 1, screen width() / 2, screen height() / 2, 1
Rem Set the character sprite to always draw to the front
Set sprite priority 1,1
`********************************************************************************
do
Text 0,20,"FPS: "+STR$(Screen FPS())
handlemovement()
sync
LOOP
`*********************************************************************************
function handlemovement()
play sprite 1,25,48,100
if keystate(57)=1
play sprite 1,49,72,60
endif
if keystate(30)=1
play sprite 1,1,24,100
rotate sprite 1, sprite angle(1)-2
endif
if keystate(32)=1
play sprite 1,1,24,100
rotate sprite 1, sprite angle(1)+2
endif
if keystate(17)=1
play sprite 1,1,24,40
move sprite 1,2
endif
if keystate(17) and keystate(42)=1
play sprite 1,1,24,80
move sprite 1,2
endif
if keystate(31)=1
play sprite 1,1,24,40
move sprite 1,-2
endif
ENDFUNCTION
Ok.. I figured out the shooting but now the sprite takes one shot across the screen on startup. how do i stop this? here is what i have now. i'm working on making a gauntlet style game.
set display mode 1024,768,32
color backdrop rgb(0,0,0)
sync rate 0
sync on
sync rate 50
load image "media\player\skeleton_walk_001.png",1,1
load image "media\player\arrow_001.png",2,1
create animated sprite 1, "media\player\skeleton_walk_001.png",24,3,1
load image "media\player\arrow_001.png",2
sprite 1,0,0,1
sprite 2,0,0,2
offset sprite 1, sprite width(1) / 2, sprite height(1) / 2
offset sprite 2, sprite width(2) / 2, sprite height(2) / 2
sprite 1, screen width() / 2, screen height() / 2, 1
sprite 2, screen width() / 2, screen height() / 2, 2
Rem Set the character sprite to always draw to the front
Set sprite priority 1,1
`********************************************************************************
do
Text 0,20,"FPS: "+STR$(Screen FPS())
handlemovement()
sync
LOOP
`*********************************************************************************
function handlemovement()
play sprite 1,25,48,100
if keystate(57)=1
play sprite 1,49,72,60
endif
if keystate(30)=1
play sprite 1,1,24,100
rotate sprite 1, sprite angle(1)-2
endif
if keystate(32)=1
play sprite 1,1,24,100
rotate sprite 1, sprite angle(1)+2
endif
if keystate(17)=1
play sprite 1,1,24,40
move sprite 1,2
endif
if keystate(17) and keystate(42)=1
play sprite 1,1,24,80
move sprite 1,2
endif
if keystate(31)=1
play sprite 1,1,24,40
move sprite 1,-2
endif
if keystate(57)=1
sprite 2,sprite x(1),sprite y(1),2
scale sprite 2,50
rotate sprite 2,sprite angle(1)
endif
if sprite exist(2)
move sprite 2,10
endif
ENDFUNCTION