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

#1 2012-05-03 02:09:42

ifelon82
New Scratcher
Registered: 2012-05-03
Posts: 4

Game coding help

Hey i was just wandering, how i could make sprite 1 change costume then change back to prev costume when i click sprite 2. all help appreciated. thanks

Offline

 

#2 2012-05-03 02:41:28

ManaUser
Scratcher
Registered: 2009-03-11
Posts: 100+

Re: Game coding help

for sprite 1

When i receive [change v]
Switch to Costume [costume 2 v]
wait (1) secs
Switch to Costume [costume 1 v]
for sprite 2
When [Sprite 2] Clicked
Broadcast [change v]
Or something like that.


http://i.imgur.com/SPYSM.gif http://i.imgur.com/t9k1Z.gif http://i.imgur.com/OwYVa.gif http://i.imgur.com/0qlZq.gif

Offline

 

#3 2012-05-03 07:30:34

jontmy00
Scratcher
Registered: 2011-11-28
Posts: 1000+

Re: Game coding help

ifelon82 wrote:

Hey i was just wandering, how i could make sprite 1 change costume then change back to prev costume when i click sprite 2. all help appreciated. thanks

Sprite 1:

when gf clicked
switch to costume [costume 2 v]
forever
if <(Sprite 2 Clicked ?) = [true]>
switch to costume [costume 1 v]
else
switch to costume [costume 2 v]
Sprite 2:
when gf clicked
forever
if <<touching [mouse-pointer v] ?> and <mouse down ?>>
set [Sprite 2 Clicked ? v] to [true]
else
set [Sprite 2 Clicked ? v] to [false]
Hope it helps.  big_smile


FOR ALL THE NEWS ON UPDATES FOR SIMPLISTICRAFT, CLICK HERE.

Offline

 

#4 2012-05-03 10:27:29

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Game coding help

jontmy00 wrote:

ifelon82 wrote:

Hey i was just wandering, how i could make sprite 1 change costume then change back to prev costume when i click sprite 2. all help appreciated. thanks

Sprite 1:

when gf clicked
switch to costume [costume 2 v]
forever
if <(Sprite 2 Clicked ?) = [true]>
switch to costume [costume 1 v]
else
switch to costume [costume 2 v]
Sprite 2:
when gf clicked
forever
if <<touching [mouse-pointer v] ?> and <mouse down ?>>
set [Sprite 2 Clicked ? v] to [true]
else
set [Sprite 2 Clicked ? v] to [false]
Hope it helps.  big_smile

Or you could optimize it by removing the

switch to costume [costume 2 v]
after the green flag block.  big_smile

Offline

 

Board footer