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

#1 2012-08-14 15:03:22

bullelk12
Scratcher
Registered: 2012-05-26
Posts: 100+

wall detection help!

I found this scratch project http://scratch.mit.edu/projects/RHY3756547/845502
and it's the best wall detection I've ever seen! But I downloaded it and tried to figure out how the wall detection worked but couldn't. If I don't understand how it'll drive me insane. Can anyone explain how this works sooooo well?

Last edited by bullelk12 (2012-08-14 15:03:47)


http://mag.racked.eu/cimage/i6000/Achievement++get%21/Scratcher+love+minecraft%21/mca.png

Offline

 

#2 2012-08-14 15:11:39

beyblade4
Scratcher
Registered: 2011-08-02
Posts: 1000+

Re: wall detection help!

bullelk12 wrote:

I found this scratch project http://scratch.mit.edu/projects/RHY3756547/845502
and it's the best wall detection I've ever seen! But I downloaded it and tried to figure out how the wall detection worked but couldn't. If I don't understand how it'll drive me insane. Can anyone explain how this works sooooo well?

Well the way he creates his projects are quite complicated, it is all based on if touching the Level and then it'll set variables which will configure movement, but that is a bit too complicated to explain, if not you can either use Sensors or Touching Color sensors


http://blocks.scratchr.org/API.php?user=beyblade4&action=projects&type=newest&return=image&num=NUMBER

Offline

 

#3 2012-08-14 15:11:55

powerpoint56
Scratcher
Registered: 2012-04-19
Posts: 500+

Re: wall detection help!

Not exactly sure this would be Help with Scripts or anywhere else...

Help with Scripts Description wrote:

Need help with your Scratch project? Ask here!

I'm not sure. It's probably something about the

([abs v] of ((velocity)/(2)))
that does it.


http://i48.tinypic.com/2072ctw.gif

Offline

 

#4 2012-08-14 15:23:44

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

Re: wall detection help!

bullelk12 wrote:

I found this scratch project http://scratch.mit.edu/projects/RHY3756547/845502
and it's the best wall detection I've ever seen! But I downloaded it and tried to figure out how the wall detection worked but couldn't. If I don't understand how it'll drive me insane. Can anyone explain how this works sooooo well?

I just glanced at his script and immediately saw why you were having troubles.  From what I can see some of it is overcomplicated, but overall, it's simply a long script.  I've had some experience making platformers (and a lot of experience using the sprite as a sensor by moving it, which is what RHY does), and was able to make some sense out of it:

The key reason it works so well is that it is able to do a ton of movements and calculations really quickly by using the Single Frame technique.  The upshot of this technique is that you can do a ton of calculations per frame (allowing for a great degree of accuracy in his movement script, which allows him to immediately stop the sprite right next to the wall).  The downside is that it makes programming take longer (not just moving more blocks, but it makes Scratch really laggy if you use it extensively) and it makes the script more difficult to read.

powerpoint56 wrote:

I'm not sure. It's probably something about the

([abs v] of ((velocity)/(2)))
that does it.

Whenever I saw that block in his script it was connected to slope detection (whenever you hit a wall, you move upwards at half the x velocity).

Last edited by MoreGamesNow (2012-08-14 16:53:13)


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

Offline

 

Board footer