Moving sprites

Create fast, sprite powered games with Animation Engine, co-developed with DerBrill Software!

Moderators: heatherlaine, kevinmiller, robinmiller, malte

Post Reply
JosepM
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 344
Joined: Tue Jul 20, 2010 12:40 pm

Moving sprites

Post by JosepM » Mon Dec 27, 2010 6:24 pm

Hi Malte,

Following my experiments.. to move a transparent button... this is a card script.

Button "b_ghost" have the on "aeEnterFrame" that change the icon image.

constant K_GHOST_VEL = 15

on rawKeyDown keyCode
put the location of button "b_ghost" into tLocation

switch keycode
case 65361
put item 1 of tLocation - K_GHOST_VEL into item 1 of tLocation
aeMoveTo the long ID of button "b_ghost", tLocation,0
break
case 65363
put item 1 of tLocation + K_GHOST_VEL into item 1 of tLocation
aeMoveTo the long ID of button "b_ghost", tLocation,0
break
case 65362
put item 2 of tLocation - K_GHOST_VEL into item 2 of tLocation
aeMoveTo the long ID of button "b_ghost", tLocation,0
break
case 65364
put item 2 of tLocation + K_GHOST_VEL into item 2 of tLocation
aeMoveTo the long ID of button "b_ghost", tLocation,0
break
end switch

pass rawkeydown
end rawKeyDown

Any other way? I detect that the movement when change the direction is stoped and begin again, how can I do it more fluid?

Salut,
Josep

JosepM
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 344
Joined: Tue Jul 20, 2010 12:40 pm

Re: Moving sprites

Post by JosepM » Fri Dec 31, 2010 6:31 pm

Any help ... :(

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Re: Moving sprites

Post by malte » Sat Jan 01, 2011 12:02 am

Hi Josep,

how exactly do you want the ghost to move?

JosepM
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 344
Joined: Tue Jul 20, 2010 12:40 pm

Re: Moving sprites

Post by JosepM » Sat Jan 01, 2011 12:39 pm

I like to move like "pacman" :) I'm trying to create a ortogonal map and the move is over squares.
The user move the "hero" with the cursors keys.

Here I post my experiments..

http://forums.runrev.com/phpBB2/viewtop ... 267#p29139

But when press other direction it's freezing..

Salut,
Josep

Post Reply

Return to “Animation Engine”