I think this would be very useful for people who want their sprite to react differently when touched at different points. Many people have tried making a sprite that follows another sprite to determine where a sprite has been touched but the results are often inaccurate as the sprites can't follow another sprite well enough.
Example of how these blocks could be used:
///On player sprite
when flag pressed
wait until touching "platform" at x("x position") y(y position+20)
say "ow I hit my head"
If you added sprite length and sprite width blocks as well you could make the code work regardless of a sprites hight.
///On player sprite
when flag pressed
wait until touching "platform" at x("x position") y(y position+("sprite's lenght"/2))
say "ow I hit my head"
Last edited by archmage (2007-08-14 18:08:54)
Offline
AlveKatt wrote:
Can't you just use more than one sprite and tie them together?
Many people have tried doing this but even if you set one sprite to forever go to the x and y coordinates of another sprite it won't follow it perfectly. Also these blocks would remove them need for such tedious tasks.
Offline
instead of making one sprite follow the other, create variables X and Y and use those variables to move both sprites. That way they stick together better.
Offline
Moving sprites independently, even to the same locations, can cause them to get out of sync. The problem is worse on slower machines, as the overhead of interpreting the code is larger and the time between the moves is larger.
Is "touching at x y" a good solution though? If so, should the x,y be in absolute coordinates as suggested, or in sprite relative coordinates? The example given showed doing a translation to get sprite-relative coordinates, but that did not take into account rotation of the sprite.
The other way people seem to handle the problem is to color the sensor area specially, and use color over color. Perhaps what people want is to be able to add sensor areas to a sprite (perhaps invisibly) and detect "sensor area 3 touching sprite" or "sensor area 3 touching color".
Offline
Can't you do this with variables now? This topic is seriously old
Offline
MathWizz wrote:
*bump* Great idea!
this can also be replicated with variables, like this:
when gf clicked set [x pos v] to <x pos you want> set [y pos v] to <y pos you want> wait until<<<x position> = (x pos)> and <<y position> = (y pos)>> do stuffPlease, next time you post, look at the time of the post before you.
Last edited by TorbyFork234 (2012-05-10 00:44:16)
Offline