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

#1 2011-03-02 14:36:44

ConnorMoir
New Scratcher
Registered: 2011-03-01
Posts: 1

Need help with a script please :)

Hello. I am currently working on a simple game as I am new to Scratch. I am unsure of 2 things.

Is there a way to have sprites automatically spawn in different places outside of the stage, and then move to the center of the stage?

Also, I am trying to make it so when you move your little sword that follows the mouse over an enemy, the enemy's costume changes and it stops moving, or something similar. I am currently trying this. (Sprite 1 = Sword, Sprite 2 = Enemy, Sprite 3 = Dead Enemy)

Sprite 1

<when green flag clicked>
<if><touching[Sprite2]>
<switch to costume[ Sprite 3]

(sorry if I have added to blocks wrong, but hopefully you understand.

Offline

 

#2 2011-03-02 18:34:55

kingofdallamas
Scratcher
Registered: 2010-03-07
Posts: 500+

Re: Need help with a script please :)

YOu might want to make the dead enemy receive something. The first part is correct but the rest, here:
For the sprite 1's script
When green flag clicked
<if touching sprite 2>
broadcast <die!>

For the dead enemy's script:
When green flag clicked,
switch to costume <1>

Costume one above must be the Alive costume of the enemy.
Continued...

When I receive <die>
switch to costume <2>
hide

Costume two will then have to be the costume that shows the enemy died.

Hope this helps, and good luck!  wink


http://i853.photobucket.com/albums/ab99/Gilgamesh1192/Ninja%20Saga/ElementalJutsus2.gifhttp://i27.photobucket.com/albums/c192/BoomKaTish/GIF/thgfhgfhfhgf.gif
ハロー友だち!

Offline

 

#3 2011-03-02 18:39:15

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: Need help with a script please :)

To make them go to a random location outside the stage, just do this:
http://i54.tinypic.com/157jg8.gif

Then you can make them move to the center the easy way by making a sprite, putting it at x:0, y:0, and making your enemies point to that and move to it.

Last edited by Kileymeister (2011-03-02 18:40:14)


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

Board footer