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

#1 2012-03-31 10:53:16

Summerflow
New Scratcher
Registered: 2012-03-31
Posts: 3

How can I make a sprite go into a building?

Like, I want to get a sprite to go into a building when I click on the door/press the up key above the door. I don't care if I have to click or press the up key, just tell me whichever one is easier to make. I also turned the buildings into sprites, in case that helps.

Offline

 

#2 2012-03-31 11:13:35

funelephant
Scratcher
Registered: 2010-07-02
Posts: 1000+

Re: How can I make a sprite go into a building?

This seems to belong in Help with Scripts, so I will report it to get moved  smile

when [sprite (whatever one is the outside of the building v] clicked
switch to costume [whatever one is inside the building v]


nicki begs to differ
http://24.media.tumblr.com/ab0e6e8fd347c5e39c2821bcab9d16e6/tumblr_mgu35sui1L1rfb7aqo2_500.gif

Offline

 

#3 2012-03-31 11:35:40

Summerflow
New Scratcher
Registered: 2012-03-31
Posts: 3

Re: How can I make a sprite go into a building?

Thanks, I'll try it out.

Offline

 

#4 2012-04-01 14:36:51

ty44
Scratcher
Registered: 2011-02-05
Posts: 57

Re: How can I make a sprite go into a building?

i suggest you make the door a sprite too.

for the character:

when gf clicked
forever
 if <<touching [door v]?> and <key [up arrow v] pressed?>>
  switch to costume [going through door v]
  wait (1) secs
  hide
 end
end
for the door:
when gf clicked
forever
 if <<touching [character v]?> and <key [up arrow v] pressed?>>
  switch to costume [open v]
  wait (1) secs
  hide
 end
end
for the building:
when gf clicked
forever
 if <<([costume # v] of [door v]) = [2]>> //or whatever
  wait (1) secs
  hide
  switch to costume [inside v]
 end
end
this is running upon the assumption that you want a 1 second break between scenes (i.e. inside and outside). if so,
background script:
when gf clicked
forever
 if <<([costume # v] of [door v]) = [2]>> //or whatever, again
  switch to background [change_scene v] //which is black or whatever you like
  wait (1) secs
  switch to background [(whatever) v]
 end
end
hopefully this isn't too complicated.
hope it helps.
--
Cats scratch-ponies don't. Go Neigh!


http://t3ak.roblox.com/07ffa69f8ced34c7220abf1a8008c1d1 Mario Kart OBSESSION!

Offline

 

#5 2012-04-01 14:46:33

ty44
Scratcher
Registered: 2011-02-05
Posts: 57

Re: How can I make a sprite go into a building?

funelephant wrote:

This seems to belong in Help with Scripts, so I will report it to get moved  smile

when [sprite (whatever one is the outside of the building v] clicked
switch to costume [whatever one is inside the building v]

well, yes. but up arrow needs to be the option. when your not using it, it should look like this:

when [sprite (whatever one is the outside of the building) v] clicked
if <touching [door v]?>
 switch to costume [whatever one is inside the building v]
end
so yeah. happy scratchin'

--
Cats scratch-ponies don't. Go neigh!

Last edited by ty44 (2012-04-01 14:48:18)


http://t3ak.roblox.com/07ffa69f8ced34c7220abf1a8008c1d1 Mario Kart OBSESSION!

Offline

 

Board footer