This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-10-29 07:56:20

slamdunkan
Scratcher
Registered: 2010-05-02
Posts: 1

Enemy wont stop moving

I am making a platform scrolling shooter with projectiles. The enemy has to keep moving sort of like Mario enemies. But I need it to stop moving when it is shot. Here is the script I hope that's all that is necessary.

http://26.media.tumblr.com/tumblr_lttt4f5nU01r4byqwo1_400.png

Offline

 

#2 2011-10-29 09:09:42

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: Enemy wont stop moving

Do you have a script somewhere else that's setting enemymove to 1?

Offline

 

#3 2011-10-29 09:26:05

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Enemy wont stop moving

Does it carry on moving forever or just for about 5 seconds? If it's just for about 5 seconds, then it's almost certainly because of the repeat block. If you put a repeat x times inside an if, then even if the statement in the if turns false, the script inside the repeat will carry on until it's finished the script the specified amount of times.
I hope that made sense, I'm not the best at explaining things!


Why

Offline

 

#4 2011-10-29 09:38:37

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Enemy wont stop moving

I believe the problem is that the bullet it hitting the sprite while the sprite is running its movement script.  The script only checks if it is touching a bullet once every 40 frames (approximately).  You need it to check every frame.  Does that make sense?

Your script:

Am I touching bullet?
Move forward
Move backward
Am I touching bullet
Move forward
Move backword
etc.

It only checks if it is touching a bullet once a cycle.


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#5 2011-10-29 09:52:09

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Enemy wont stop moving

MoreGamesNow wrote:

I believe the problem is that the bullet it hitting the sprite while the sprite is running its movement script.  The script only checks if it is touching a bullet once every 40 frames (approximately).  You need it to check every frame.  Does that make sense?

Your script:

Am I touching bullet?
Move forward
Move backward
Am I touching bullet
Move forward
Move backword
etc.

It only checks if it is touching a bullet once a cycle.

Yeah, that's sort of what I was saying.


Why

Offline

 

Board footer