This block would make alot of stuff a whole lot easier
Offline
That would make things really easy but it should alow for colors/colours as well.
This would help a game I made where a ball must bounce of a certain color/colour at the correct angle and for me to do this I have to use the direction that the ball is traveling in and choose which way it should rotate depending on the direction that it hits in.
Here's the link to the project contains what I mean. Download it to see how to make the ball rotate the right way depending on the direction that it hits in. (Link to project)
Last edited by what-the (2009-10-28 04:01:25)
Offline
Hey Jordanuk2, I would LOVE to see how this is easily done if you have a link?
The problems I've noticed are...
1) native Bounce command only works for the edges of the screen
2) scripting your own uses a lot of Ifs, etc so most people probably just give up
3) the hidden collision sprite with multi-color feelers works well but still suffers from variable game speed limitations among others
4) If Touching depends on how fast the object(s) are moving cause if they change direction but are still touching on the next collision check, you get a stuck object, bad angle, etc. I am currently trying to work around this using a Touching variable that only resets after the objects stop touching and also by making the moving/bouncing object travel a big step (Move) in the new direction before resuming the collision detection loop. I also use a ssytem like What-the mentioned and now I'm wondering if I couldn't use on of the directional flags instead of trying to make the bouncing object jump back out of the "touching" state before it gets checked again.
I plan to work on my next idea but even if it works, most people will never use it. It is like the way they do 3d. Instead of sensing if things are touching and using Move, it will compute direction as a line intersecting another line, say a border. Then it will Glide the object there, figuring it's speed by the distance to be traveled adjusted by a constant in order to make the overall speed adjustable. This should both eliminate the "stuck in the wall" loop and (hopefully) make projects run faster online. I've done it before using macros, just not in Scratch yet.
ps.. Steppenwolf.. I don't think they can make a functional Bounce Off Sprite command like you suggested unless they make every sprite react like a square when this command is used... which would still be cool and help a LOT of people out.
Last edited by Locomule (2009-10-29 16:12:51)
Offline
ok so i have a kid who is making a race track game and he wants you to have to stay on the track like in nascar...every game i find on here has the car or marble go slower on a different color...not bounce....for instance his "car" is a monkey and the outline of the track is black but because the track is a square or rectangle and there is all 4 directions it cant just be a simple opposite of what the car is moving...they havent gotten to velocity yet so it is simply a change X and Y by a number with a repeat...please help!
Offline
ssss wrote:
<when green flag clicked><forever if><touching[ <point in direction( ((180 <-> direction ))
That's the untidy script
It doesn't work, that just flips you around. Throw something at a wall and tell me if that happens.
Offline
I'm pretty sure you use
<if><touching[ ]
<point in direction((( 360 <-> <direction> ))
<end>
But I think that only works on the horizontal axis.
I use it in my pong project
|
|
\/
Offline
juststickman wrote:
ssss wrote:
[blocks]<when green flag clicked><forever if><touching[ <point in direction( ((180 <-> direction ))[/blocks]
That's the untidy scriptIt doesn't work, that just flips you around. Throw something at a wall and tell me if that happens.
It does if the wall is perfectly round...
Last edited by LS97 (2011-06-30 05:12:06)
Offline
Here is the proper code:
when gf clicked forever if <touching [wall v]?> point in direction ((0) - (direction)) end
Last edited by berberberber (2012-07-21 12:41:39)
Offline
berberberber wrote:
Here is the proper code:
when gf clicked forever if <touching [wall v]?> point in direction ((180) - (direction)) end
It should be 180.
Last edited by Firedrake969 (2012-07-21 13:25:06)
Offline
Firedrake969 wrote:
berberberber wrote:
Here is the proper code:
when gf clicked forever if <touching [wall v]?> point in direction ((0) - (direction)) endIt should be 180.
No, that just turns it around. Mine actually reflects.
Offline
berberberber wrote:
Firedrake969 wrote:
berberberber wrote:
Here is the proper code:
when gf clicked forever if <touching [wall v]?> point in direction ((0) - (direction)) endIt should be 180.
No, that just turns it around. Mine actually reflects.
My pong game I used 0, and it glitched. Using 180, it works.
Offline
SciTecCf wrote:
blargin wrote:
If touching [Sprite1 v] bounceCould someone who knows the code give me the code for that to put in scratch?(The block should be blue.(Motion))Necropost.
I don't get it.
Offline
blargin wrote:
SciTecCf wrote:
blargin wrote:
If touching [Sprite1 v] bounceCould someone who knows the code give me the code for that to put in scratch?(The block should be blue.(Motion))Necropost.
I don't get it.
A "Necropost" is when someone posts in a thread that has not been posted in for months.
They are generlly discouraged on scartch.
Offline
nama wrote:
blargin wrote:
SciTecCf wrote:
Necropost.
I don't get it.
A "Necropost" is when someone posts in a thread that has not been posted in for months.
They are generlly discouraged on scartch.
oh ^^^^^^^ scartch??
Last edited by blargin (2012-08-09 12:13:34)
Offline