Thanks to some earlier help and code i have control via mouse using point n click to move spites around the screen, i have now tried to add 8 way movement/animation to the code but it's not working to well.
Sometimes no animation palys and sometimes its the wrong animation.
I've attatched the Sprite Sheet (Sprites From http://reinerstileset.4players.de/englisch.html)
[URL=http://s508.photobucket.com/albums/s329/tonycrew/?action=view¤t=OgreWALK01.png]
[/URL]
Sync on
Sync rate 30
Rem Initial coordinates
Rem Player
x as float=100.0
y as float=100.0
speed as float=3.0
Rem Goal
xdest as float =450.0
ydest as float =300.0
Rem aux var
angle as float
Rem Load the sprite sheet into an animated sprite
create animated sprite 1,"OgreWALK01.png",8,8,1
mc = 0
WalkR:
disable escapekey
do
Rem if mc = 0 then text 0,0,"Click where you want to go"
Rem Show the sprite at 100,100
sprite 1,X,Y,1
Rem play sprite 1,3,3,100
Rem change goal position
if mouseclick()=1 and mc = 0
mc = 1
xdest=mousex()
ydest=mousey()
endif
if abs(x - xdest) < speed and abs(y - ydest) < speed and mc = 1
time = timer() + 1000
repeat
Rem text 100,200,"You are there"
sync
until timer() > time
mc = 0
else
if mc = 1
Rem Play Correct Animation For Direction Traveling
if xdest >= x and ydest = y then play sprite 1,1,8,100 // Sprite Left
if xdest <= x and ydest = y then play sprite 1,57,64,100 // Sprite Right
if xdest <= x and ydest > y then play sprite 1,16,24,100 // Sprite Up Right
if xdest <= x and ydest > y then play sprite 1,25,32,100 // Sprite Up Left
if ydest >= y and xdest = x then play sprite 1,33,40,100 // Sprite up
if ydest <= y and xdest = x then play sprite 1,9,16,100 // Sprite Down
if ydest <= y and xdest < x then play sprite 1,41,48,100 // Sprite Down Right
if ydest <= y and xdest > x then play sprite 1,51,56,100 // Sprite Down Left
Rem Move Palyer Towards Mouse (X,Y)
angle = atanfull(ydest - y,xdest - x)
x = x + speed * cos(angle)
y = y + speed * sin(angle)
endif
endif
Sync
if keystate(1) = 1 then exit
loop
delete sprite 1
end
FPS Creator Updated 116 + Loads of Addon Packs DBPro DarkAI,eXtends,Dark Physics, Dark Lights
1Gig Graphics Card, 4 Gig DDR2 Ram, Intel Duel Core 3GHZ CPU