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

#1 2012-07-10 08:27:59

concentrating
New Scratcher
Registered: 2012-06-28
Posts: 19

Solid objects

I want to know how to make a solid object that you cannot jump through and still have a gravity function

Offline

 

#2 2012-07-10 09:21:28

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Solid objects

concentrating wrote:

I want to know how to make a solid object that you cannot jump through and still have a gravity function

Well...since you haven't given a lot of specifics...the most important thing you'll need is this block:

<touching [Sprite1 v]?>


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

#3 2012-07-10 09:56:40

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

Re: Solid objects

Do you basically want a platformer-physics script (if so, be more specific about what you want, like wall jumping, acceleration along the x axis, etc.) or do you already have that working and you want a wall that can be affected by gravity?


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

Offline

 

#4 2012-07-10 11:34:43

concentrating
New Scratcher
Registered: 2012-06-28
Posts: 19

Re: Solid objects

I want to have multiple levels so i need the platforms to be in the backround.

Offline

 

#5 2012-07-10 11:42:32

concentrating
New Scratcher
Registered: 2012-06-28
Posts: 19

Re: Solid objects

I almost forgot. I have already tried using When Gf clicked forever if/else if- touching color change y by 1 else- change y by -1. It works with the gravity but platforms will take you through them,

Offline

 

#6 2012-07-14 15:07:11

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

Re: Solid objects

when gf clicked
set [y v] to (0)
forever
change [y v] by (-0.1)
change y by (y)
if<touching color []?>
set [y v] to ((-0.5)*(y))
change y by (y)
if<touching color []?>
change y by (y)
end
if<<key [up arrow v] pressed?> and <(y) > (0)>>
set [y v] to (5)
end
end
if<key [right arrow v] pressed?>
change x by (3)
if<touching color []?>
change x by (-3)
end
end
if<key [left arrow v] pressed?>
change x by (-3)
if<touching color []?>
change x by (3)
end
end


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

Offline

 

#7 2012-07-15 12:11:38

concentrating
New Scratcher
Registered: 2012-06-28
Posts: 19

Re: Solid objects

What does this script do I tried it and nothing happened

Offline

 

#8 2012-07-15 15:20:43

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

Re: Solid objects

It should be a platformer script

Did you set the

<touching color[]?>
to the color of your walls?

Last edited by MoreGamesNow (2012-07-15 15:21:14)


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

Offline

 

#9 2012-07-16 07:31:49

concentrating
New Scratcher
Registered: 2012-06-28
Posts: 19

Re: Solid objects

yes i did

Offline

 

#10 2012-07-16 08:01:39

concentrating
New Scratcher
Registered: 2012-06-28
Posts: 19

Re: Solid objects

I tried it again and it works for walking smoothly but it does have a glitch but I fixed it

Offline

 

#11 2012-08-02 08:01:16

concentrating
New Scratcher
Registered: 2012-06-28
Posts: 19

Re: Solid objects

I have figured out a good solid platform script but now I want to have wall jumping and acceleration along the x axis. Could you please show me a good script for this. Thank you.

Offline

 

#12 2013-03-19 14:51:52

wdfgbw46h
New Scratcher
Registered: 2013-03-19
Posts: 1

Re: Solid objects

how can i make a solid platform really quickly please help me

Offline

 

#13 2013-03-19 15:15:30

CAA14
Scratcher
Registered: 2013-01-14
Posts: 1000+

Re: Solid objects

wdfgbw46h wrote:

how can i make a solid platform really quickly please help me

Solid platform... Well:

when gf clicked
forever
if  < <touching color? [#000000]>  and  < not < key [space v] pressed?> > >
set [yvel v] to [0]
end
end

Hope that helps,

CAA14

Last edited by CAA14 (2013-03-19 15:16:59)

Offline

 

#14 2013-03-19 16:50:34

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

Re: Solid objects

when gf clicked
set [y v] to (0)
forever
change [y v] by (-0.1)
change y by (y)
if<touching color []?>
set [y v] to ((y)/(-2))
change y by (y)
if<touching color []?>
change y by (y)
end
if<<key [up arrow v] pressed?> and <(y) > (0)>>
set [y v] to (5)
end
end
if<key [right arrow v] pressed?>
change [xvel v] by (0.5)
end
if<key [left arrow v] pressed?>
change [xvel v] by (-0.5)
end
set [xvel v] to ((xvel)*(0.9))
change x by (xvel)
if<touching color []?>
set [xvel v] to ((xvel)/(-2))
change x by (xvel)
if<touching color[]?>
change x by (xvel)
end
if<<key [up arrow v] pressed?> and <(y) < (0)>>
set [y v] to (4)
if<(xvel) > (0)>
set [xvel v] to (3)
else
set [xvel v] to (-3)
end
end
That should do it

Last edited by MoreGamesNow (2013-03-19 16:53:37)


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

Offline

 

#15 2013-03-19 16:51:52

CAA14
Scratcher
Registered: 2013-01-14
Posts: 1000+

Re: Solid objects

MoreGamesNow wrote:

when gf clicked
set [y v] to (0)
forever
change [y v] by (-0.1)
change y by (y)
if<touching color []?>
set [y v] to ((y)/(-2))
change y by (y)
if<touching color []?>
change y by (y)
end
if<<key [up arrow v] pressed?> and <(y) > (0)>>
set [y v] to (5)
end
end
if<key [right arrow v] pressed?>
change [xvel v] by (0.5)
end
if<key [left arrow v] pressed?>
change [xvel v] by (-0.5)
end
set [xvel v] to ((xvel)*(0.9))
change x by (xvel)
if<touching color []?>
set [xvel v] to ((xvel)/(-2))
change x by (xvel)
if<touching color[]?>
change x by (xvel)
end
end
One sec, adding wall jumping.

Hey, i have a question... Why is the yvel always going down? Wouldn't that make it fall through the platforms?

Regards,

CAA14

Offline

 

Board footer