Mouse behavior when sprite is attached

0 favourites
  • 2 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • Hi all,

    wanted to write another tut about simulating the famous

    Subscribe to Construct videos now

    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:

    <img src="https://dl.dropboxusercontent.com/u/50943616/Construct2/Screenshot_Oxyd_Code.png" border="0">

    Thanks and regards,

    Dan72

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 1. You could give the ball an active boolean and set it true when the mouse changes from (0,0). Like this:

    <img src="https://dl.dropboxusercontent.com/u/8367729/construct/pics/ballActive1.PNG" border="0">

    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)

    <img src="https://dl.dropboxusercontent.com/u/8367729/construct/pics/ballActive2.PNG" border="0">

    Oxyd_Enigma1_edit.capx

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)