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

#1 2010-08-04 11:12:47

cfunke
Scratcher
Registered: 2009-07-20
Posts: 8

How to walk up and down a hill?

I've got a couple of students working on side scrollers right now and they would like to make it so their characters can walk up and down hills instead of just staying on a level platform but their characters are either walking through the hills or just slowly gliding up as they walk through them.  Is there a way to do this smoothly?

I uploaded one of their files here... http://scratch.mit.edu/projects/cfunke/1228695

It's a mess but you'll get the general idea.

Offline

 

#2 2010-08-04 11:15:14

JeanTheFox
Scratcher
Registered: 2010-06-14
Posts: 1000+

Re: How to walk up and down a hill?

Yikes... I think I can help you, I just need to remove some of the enemies by downloading...


http://i51.tinypic.com/20gcn5j.png

Offline

 

#3 2010-08-04 11:15:51

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: How to walk up and down a hill?

Sensors could work.


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#4 2010-08-04 11:22:26

JeanTheFox
Scratcher
Registered: 2010-06-14
Posts: 1000+

Re: How to walk up and down a hill?

I'd go with using sensors. As in the script "If touching ground 4 and not touching... yada yada yada what with all the other grounds change Y by 10." I'm pretty sure that should work.


http://i51.tinypic.com/20gcn5j.png

Offline

 

#5 2010-08-04 11:24:22

06dknibbs
Scratcher
Registered: 2008-01-29
Posts: 1000+

Re: How to walk up and down a hill?

I'd suggest looking at Archmage's scrolling demo for something like that.

If you used hit tests, then Mario should be able to jump up the hill instead of walking through it.  smile

Last edited by 06dknibbs (2010-08-04 11:26:48)


http://i404.photobucket.com/albums/pp129/06dknibbs/Untitled-3-6.jpg

Offline

 

#6 2010-08-04 12:26:48

cfunke
Scratcher
Registered: 2009-07-20
Posts: 8

Re: How to walk up and down a hill?

I've been wondering about hit test but can't find any documentation on it.  I think I see how it works from that demo though. Thanks.

Offline

 

#7 2010-08-04 17:41:33

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: How to walk up and down a hill?

my project here...
http://scratch.mit.edu/projects/Locomule/1204343
does that on the first map

I also made it so that if you jump onto the hill you land higher or lower depending on which direction you jump. It is not perfect but is pretty effective. The hill has a slight bug of when you stop, then start moving again on it which I figured out how to fix but haven't worked on the project since.

Last edited by Locomule (2010-08-04 17:43:15)


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

Board footer