Posted By
|
Message
|
stuff2
Registered 16/05/2010
Points 7
|
26th May, 2010 at 00:04:49 -
I've only recently started out using mmf2, so this most likely will be a newbie question to ask:
I've got the sprite of a piece of fruit on the top of my screen.
I've got a sprite of a tray passing by from left to right, using the Path Movement set to Loop and Reposition Object At End. So I get the effect that trays are coming nonstop from left to right.
I've assigned a Pinball Movement to my piece of fruit, with only the direction '24' selected, so it would always fall straight down.
Now what I wanted to achieve is:
- when I click my left mouse button, the fruit falls down
- when the fruit hits the tray, it moves along with the tray
- when I click my left mouse button again, the fruit would fall off the tray .
What I got so far, and wich doesn't work, is this:
*User clicks with left button
- Start Movement
* Colission between Fruit and Tray
-Fruit: Set X position to X("Tray")
-Fruit: Set Y position to Y("Tray")
The Fruit drops when I click and stops when it collides with tray, but it then jumps to a position in the direction the tray is moving, rather then 'stay on the tray'.
I haven't even got around to think of a way to let the Fruit fall of the tray again :/
Any help would be greatly appreciated.
n/a
|
Mr_Tom
Registered 01/12/2007
Points 389
|
26th May, 2010 at 00:11:25 -
Im guessing that with your current code what is happening is that its position is being set to whatever the coordinates of the tray were at the instance of collision and then of course the tray moves and it has new coordinates. It might be simple to fix by having 'Always; when fruit is overlapping the tray -> set the position to trays position'.
Oooh actually also when you say 'jumps position when it collides. Check where the hotspot of the fruit is because its (0,0) coordinate may be way off its centre causing it to position wildly off course.
Edited by Mr_Tom
n/a
|
Watermelon876
Registered 16/04/2009
Points 27
|
26th May, 2010 at 04:31:45 -
Collision->Fruit is overlapping Tray:
-Fruit: Set X position to X("Tray")
-Fruit: Set Y position to Y("Tray")
Fruit: Movement->Stop
Awesomeness is Watermelon.
*/l、
゙(゚、 。 7
l、゙ ~ヽ
じしf_, )ノ
This is Koji. Copy and paste Koji to your sig so he can acheive world domination.
|
stuff2
Registered 16/05/2010
Points 7
|
26th May, 2010 at 23:24:07 -
Thank you two for such a quick reply
It works now. It seems a bit silly when you see the logic of it afterwards . I guess it's exploring-time in mmf2 for me
n/a
|
|
|