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

#1 2012-03-11 06:09:14

JohnVialls
New Scratcher
Registered: 2012-03-11
Posts: 4

im making a project and i need help

Im making a portal game like portal 2 and ive been wondering how i am going to make it so when clicked your mouse, a portal appears and when you walk into it you teleport to the other colour portal. Does anyone know how to help?

Offline

 

#2 2012-03-11 09:58:42

turkey3
Scratcher
Registered: 2011-12-04
Posts: 500+

Re: im making a project and i need help

This script can go for any sprite

When gf clicked
Forever if <mouse key clicked>
Broadcast [whatever v]
Stop script
now put this script in the portal sprite
When I receive [whetever v]
Show
now this next script goes in the sprite that will be walking into the teleporter
When I receive [whatever v]
Forever if <touching [the portal v]>
Go to [the other portal]
This should work except I don't know of you can make it "if mouse key clicked"
    If you can't use the mouse key try the space bar or something.

Last edited by turkey3 (2012-03-11 10:00:57)

Offline

 

#3 2012-03-11 12:53:53

JohnVialls
New Scratcher
Registered: 2012-03-11
Posts: 4

Re: im making a project and i need help

thanks  smile  it works but the only problem is that the sprite gets stuck, should i make it bigger? would that help?

Offline

 

#4 2012-03-11 19:04:01

DaScratcher101
Scratcher
Registered: 2012-02-16
Posts: 41

Re: im making a project and i need help

I can help  big_smile 

when gf clicked
forever
if [touching portal v]
go to [portal 2 v]
repeat until [not touching portal 2 v] 
move [10] steps
Use turkey 3's  mouse click thing. But all you need to do is put in both the portals's scripts,                                                                                                   
if [mouse down?]
show

Offline

 

#5 2012-03-11 19:35:24

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

Re: im making a project and i need help

@DaScratcher101

That only works if you're facing away from the portal when you're in the portal.  Otherwise, you could end up moving into the wall!  While I was making my portal game, I found it necessary to know the direction of each portal, do calculate velocity changes and make the sprite not be stuck in a wall.


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

Offline

 

Board footer