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

#1 2010-07-18 18:51:58

lilacfuzz101
Scratcher
Registered: 2010-05-22
Posts: 1000+

Question...

Is there a way to get one Sprite to stick to another and then un-stick? I'm making a Dress Up the LGM (Little Green Man from the TS movies) game. When you hit clear in the game "The Claw" comes down and picks him up. the idea is that the clothes and items will move with him and then come back down after he is off the screen and then he comes back.


http://25.media.tumblr.com/tumblr_lzqaicLrY01r5wdo7o1_500.gif

Offline

 

#2 2010-07-18 18:55:14

MaxtheWeirdo
Scratcher
Registered: 2010-03-18
Posts: 500+

Re: Question...

Make a "Sticky" variable.
If sticky = 1
stick
else
not stick
end


My website. Hall Crawler My Awesome OS
It's just marketing, guys! Nothing sinister!

Offline

 

#3 2010-07-18 19:00:35

laser100
Scratcher
Registered: 2009-12-04
Posts: 100+

Re: Question...

You could do this for the clothes:
Repeat until<y position of LGM = (insert whatever number you want)>
[Go to x:x position of LGM+(correct position number)y:y position of LGM+(correct position number)]
end repeat
[Go to x:(correct x position)y:(correct y position)]

Offline

 

#4 2010-07-18 19:06:51

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Question...

Well, for a dress-up game, what you probably want is something like this:

When green flag clicked
forever
  if <touching person>
    set offsetx to (x position of person - x position)
    set offsety to (y position of person - y position)
    forever
      go to x (x position of person + offsetx) y (y position of person + offsety)
    end forever
  end if
end forever

Offline

 

Board footer