How could i get the mouse press positions set.

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!
  • I try use Array to recording the position of mouse at every times press.

    But i don't know how could get a index to write array elements. I use a Text box and i set the type be Number. Hope i can get the number as Array's index. But it's always said "this parameter requires a number, not a string"!! I know it's need a int or something. but there is no integer or another type. Someone help me? for this stupid problem...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think the easy way is to it let make the index by it self. To do that use Array > action > Push.

    If you do that, you have 2 options.

    Option 1: Start with an empty array. (dimensions 1,3,1). To let it fill the array with an unlimeted amount of mouse coordinates.

    Every tick

    Action > Array > Push ... X axis .. value dont matter ... front

    Action > Array > Set at XY > X=0 .. Y=1 .. value = Mouse.X

    Action > Array > Set at XY > X=0 .. Y=2 .. value = Mouse.Y

    Now the array fills, with the latest coordinates at index X=0

    Option 2: Suppose you want to store a limited amount of mouse coordinates. Lets say 2000. Then you start with an array with dimensions 2000,3,1.

    Now.

    Every tick

    Action > Array > Push ... X axis .. value really dont matter... front

    Action > Array > Set at XY > X=0 .. Y=1 .. value = Mouse.X

    Action > Array > Set at XY > X=0 .. Y=2 .. value = Mouse.Y

    Action > Array > Pop > X axis ... back.

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