The Dink Network

freezing a sprite controlled by a loop

October 20th 2010, 09:00 AM
sob_scorpr.gif
Rilian
Peasant They/Them United States
 
Hi,
I am writing a script that freezes a character on the screen when you touch an object. The character is moving back and forth using a goto loop, a move and a move_stop command. This script is attached to the moving sprite.

I've attached a script to a static object that should freeze the moving sprite when I touch it. I have set the touch value to 0 so it doesn't continually run the touch command while I am executing the contents. I can make the moving sprite say something, but I can't get it to stop moving, even when I use the freeze(&moving_sprite); command.

Is there any way to use a freeze command in a separate script to get the moving sprite to break out of its move loop? I could just kill the sprite and generate a new one on the spot and re-attach the script to that new sprite after the dialogue, but it is a very inefficient way of doing things. I can post my code later today hopefully if someone wants to take a look. Thanks!
October 20th 2010, 09:20 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
Well a sprite can move with move_stop() even if it's frozen. In fact, this is how most cutscenes are done. Frozen simply means it can't move or attack out of its own accord anymore. To achieve what you want, set the sprite's speed to 0 instead. With sp_speed().

Hope that helps
October 20th 2010, 09:45 AM
sob_scorpr.gif
rilian
Peasant They/Them United States
 
Great, thanks - I'm a little new to this scripting language if you can't tell. I'll give that a shot tonight.
October 20th 2010, 02:54 PM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
No problem, we're always here to help out
October 21st 2010, 02:14 AM
fairy.gif
ToKu
Peasant He/Him Austria
Think positiv. Say NO. 
When you are talking about the animation of the sprite that you want to stop while it is talking use:
sp_picfreeze(&current_sprite, 1);