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

#1 2011-03-14 02:46:50

ssss
Scratcher
Registered: 2007-07-29
Posts: 1000+

A script for "blocking" a sprite?

Hi, I'm making a game, but i want it to be so you can't jump through objects. I don't want to use colour sensing, and I want it to be compressed to the minimum amount of scripts (To be able to play project online, it is good graphics, and slow game if there is to many scripts  wink   Thanks!


Hey.  It's me SSSS, back from the dead!  smile

Offline

 

#2 2011-03-14 02:59:55

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Re: A script for "blocking" a sprite?

Yeah, color sensing is no good. If you don't want a tile-based game, really the only other option left to you for collision involves the <touching [sprite] block>.

RHY has a really good platform collision system that doesn't use color sensing. You've probably seen it. It's as easy as: If I'm moving right and am touching the collision object move left, if I'm moving left and am touching the collision object move right, etc. It's a little hard to perfect though.

Alternatively you could use the "last good position" collision method. In that you have a ghost sprite that makes every move before the visible sprite. If the ghost sprite moves and is touching a collision object, it tells the visible sprite not to move. Otherwise, the main sprite jumps to the ghost sprite. Paddle2see's test account has an example of this.

Offline

 

#3 2011-03-14 16:03:12

rantg
Scratcher
Registered: 2010-10-16
Posts: 99

Re: A script for "blocking" a sprite?

[blocks<change x by( <touching color[ <forever if><when green flag clicked>]You could use a diffrent colour for each thing. ex. the top of the platform is one color the side, another, the bottom yet another, and the last side a fourth.


http://www.mariowiki.com/images/4/47/JumpBlock_3D.png  yikes  My song request page has passed the 100 post mark!

Offline

 

#4 2011-03-14 16:21:58

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Re: A script for "blocking" a sprite?

ssss wrote:

I don't want to use colour sensing

Offline

 

#5 2011-07-02 15:40:32

rantg
Scratcher
Registered: 2010-10-16
Posts: 99

Re: A script for "blocking" a sprite?

you could use x velocity movement and say {if touching wall color set x velocity variable to x velocity variable * -1}


http://www.mariowiki.com/images/4/47/JumpBlock_3D.png  yikes  My song request page has passed the 100 post mark!

Offline

 

Board footer