Mouse behavior when sprite is attached

Get help using Construct 2

Post » Sat Oct 12, 2013 9:59 pm

Hi all,

wanted to write another tut about simulating the famous Oxyd or its freeware successor Enigma marble memory game.

Here's the capx File

1. You might note that during startup, I position the marble on a certain position. But it moves directly to 0/0. Only if you move the mouse a bit, the marble starts moving towards the mouse cursor.
--> It seems Construct 2 sees the mouse in the beginning at 0/0.
Inserting Wait in the "On start of layout" does not help at all
How can the mouse position be correctly passed on to Construct 2?

I need this info so I can create a relative distance from mouse to marble, so it won't move right away to the mouse's position, if you understand what I mean. A new problem I see afterwards is that you cannot move the marble enough if the mouse was far away from the window in the browser..

2. Very strange behavior when you let the marble fall into the water. In some cases, no problem, a new marble is created at where I want it to be.

Position your mouse a bit more than over the edge and suddenly there will come more and more marbles. The animation of the falling marble is the problem. If you deactivate the animation in the code, this problem will not happen. How can I still use the animation without creating multiple marbles?

Here are the events:

Thanks and regards,

Dan72Dan722013-10-12 22:12:10
Posts: 16
Reputation: 5,991

Post » Sat Oct 12, 2013 10:33 pm

1. You could give the ball an active boolean and set it true when the mouse changes from (0,0). Like this:

2. Yes you're right it's the animation. The ball collides with the water - it's collision box shrinks - it moves and collides again - shrinks - moves - collides ....

So the ball is colliding multiple times. Actually that boolean could come in handy here as well: (Another option is to disable collisions after colliding once)

Oxyd_Enigma1_edit.capxramones2013-10-12 22:35:39
Posts: 1,520
Reputation: 25,860

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 3 guests