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

#1 2010-11-27 12:02:27

StrykerV
New Scratcher
Registered: 2010-06-15
Posts: 51

Sensing upward slopes...

In all my time playing scratch I have figured out how to do many things with it, but there's one thing I can't figure out. I already know how to make different "hiding" sprites to help the main sprite "sense" objects, but how do I make a sprite sense an upward slope and climb up it? Knowing how to do this would help me very much and help me finish some of my games I started long ago.
    Oh, and please I would like to know the best way to do it. Not some way that just works, but one that will work the best. Thanks in advance, StrykerV.


99.9999% Crazy, 0.0001% Hamburgeh Makeh  smile

Offline

 

#2 2010-11-27 12:26:43

Kileymeister_test
Scratcher
Registered: 2010-01-31
Posts: 100+

Re: Sensing upward slopes...

Try making the character change his y position by the absolute value of how fast he's going horizontally.  Then check from there immediately afterwards if he's touching the ground.

Do you know how to use velocity?  If so, put this in a script:
http://i52.tinypic.com/ncbkv9.gif
Put the second, detached part into the "else" section however many times you want to change the degree between when a slope is a slope or a wall.

Last edited by Kileymeister_test (2010-11-27 12:27:48)


Kileymeister's test account.  I upload engines and demos and stuff for public use.
Currently Working on: Grapple Arms!

Offline

 

#3 2010-11-27 12:33:57

StrykerV
New Scratcher
Registered: 2010-06-15
Posts: 51

Re: Sensing upward slopes...

Ahhh, I think I get it now, thank you, I would have never figured that out on my own.


99.9999% Crazy, 0.0001% Hamburgeh Makeh  smile

Offline

 

#4 2010-11-27 12:36:08

Kileymeister_test
Scratcher
Registered: 2010-01-31
Posts: 100+

Re: Sensing upward slopes...

StrykerV wrote:

Ahhh, I think I get it now, thank you, I would have never figured that out on my own.

Happy to help.


Kileymeister's test account.  I upload engines and demos and stuff for public use.
Currently Working on: Grapple Arms!

Offline

 

#5 2010-11-28 10:48:18

Groudon297
Scratcher
Registered: 2009-02-26
Posts: 6

Re: Sensing upward slopes...

Whats with the abs thing? please answer because I still dont get it.  neutral

Offline

 

#6 2010-11-28 11:27:59

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: Sensing upward slopes...

Groudon297 wrote:

Whats with the abs thing? please answer because I still dont get it.  neutral

Abs stands for "absolute value".  It's not that complex an idea, basically it's the positive of a number, no matter what.
Ex.
Abs(5)=5
Abs(-5)=5


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

#7 2010-11-28 16:33:56

StrykerV
New Scratcher
Registered: 2010-06-15
Posts: 51

Re: Sensing upward slopes...

Groudon297 wrote:

Whats with the abs thing? please answer because I still dont get it.  neutral

Absolute value. It's helpful because if I'm moving right my xvelocity would be negative, and without the absolute value if I was going right up a slope, I would go downward instead of up.


99.9999% Crazy, 0.0001% Hamburgeh Makeh  smile

Offline

 

Board footer