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

#1 2011-06-04 01:44:30

victini125
New Scratcher
Registered: 2011-03-28
Posts: 4

Falling problem

I am making  a game with a top down perspective.  I have a ball moving along a pathway which you control with the arrow keys. I want the ball to fall off (i.e. it will shrink and reset back to the start) when more than half the ball is off the pathway.  I cannot use (when not touching path) since this only works when the sprite is completely off the pathway.

Any ideas?

Thank you

Offline

 

#2 2011-06-04 02:35:18

emboar30
Scratcher
Registered: 2011-05-03
Posts: 100+

Re: Falling problem

This sounds quite difficult mate, but if you make two halves of the ball as sprite and have one go forever go to X x position of sprite 1+10 or something and Y y position of sprite 1. This means that it will look like a whole ball and if the whole of one half leaves the track (one sprite) than the whole thing could have a repeat 100 change size by -1 wait 0.001 seconds. Remember when using the size things that at the start you need to use the set size to something block.
Sorry if that was a bit long  big_smile  can someone correct me if this is wrong?


http://scratch.mit.edu/static/icons/buddy/788987_med.png?t=2011-05-02+15%3A14%3A41
I is epiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiic!     See my stuff here!!!!!

Offline

 

#3 2011-06-04 02:48:32

victini125
New Scratcher
Registered: 2011-03-28
Posts: 4

Re: Falling problem

Thanks emboar30
I think I understand, but it would depend on how I cut the ball. If I have two sprites together and the cut was vertical then it works when moving left and right but not when moving top to bottom.

Offline

 

#4 2011-06-04 03:24:32

emboar30
Scratcher
Registered: 2011-05-03
Posts: 100+

Re: Falling problem

victini125 wrote:

Thanks emboar30
I think I understand, but it would depend on how I cut the ball. If I have two sprites together and the cut was vertical then it works when moving left and right but not when moving top to bottom.

Thanks for correcting me  smile


http://scratch.mit.edu/static/icons/buddy/788987_med.png?t=2011-05-02+15%3A14%3A41
I is epiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiic!     See my stuff here!!!!!

Offline

 

#5 2011-06-04 07:28:58

deerel
Scratcher
Registered: 2008-08-23
Posts: 89

Re: Falling problem

Make a 1x1 pixel sprite that forever [ go to Ball. if not touches Path [ "you die" ] ].
It also not always "half of the ball out of path" (but is it nearly impossible to achieve), but is nearer to it, without hassle of right splitting.

Offline

 

#6 2011-06-04 09:43:09

victini125
New Scratcher
Registered: 2011-03-28
Posts: 4

Re: Falling problem

Thanks Deerel
That was the first thing I tried  smile
The problem is that the single pixel sprite is always surrounded by the ball sprite, so it never touches the path. As soon as the game starts [not touches path] returns true even if the ball is on the path.

Offline

 

#7 2011-06-04 09:53:42

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

Re: Falling problem

Go with the one-pixel dot idea, but make it a costume for the ball sprite instead of a separate sprite.  Make it rapidly switch between costumes and do the sensing when it is on the dot costume, like this:
http://i53.tinypic.com/orky85.gif

Now the ball won't be there to disrupt the sensing.  Also, when run in presentation mode or online, you will not see the dot costume.  That will only happen offline in normal stage size (which is designed to show all graphical changes).

Last edited by Kileymeister (2011-06-04 10:07:33)


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

 

#8 2011-06-04 18:16:51

victini125
New Scratcher
Registered: 2011-03-28
Posts: 4

Re: Falling problem

Thanks Kileymeister, that's a great idea!  I'll give that a go today.

I don't fully understand the differences between presentation mode and normal stage mode.  I'll have to look into that.

Offline

 

Board footer