Axis constraint during Drag and Drop

0 favourites
  • 6 posts
From the Asset Store
Now you can drop everything in your game with sound :)
  • I'd like to constrain objects to the X axis while dragging on the screen with Touch. I've tried several of methods suggested on this forum but have yet to find a simple solution that works. Any tips would be greatly appreciated. Thanks in advance!

  • A relatively simple way to do this would be to give the sprite an instance variable called FixedY (or whatever you want). Then create these two events:

    On Sprite created -> set Sprite.FixedY to Sprite.Y

    If Sprite.Y > Sprite.FixedY [OR] If Sprite.Y < Sprite.FixedY -> Set Sprite.Y to Sprite.FixedY.

    It's quick, but I would really appreciate it if this functionality was built in though.

  • or

    on Trigger -> set Sprite.FixedY to Sprite.Y

    every tick -> Sprite.Y set to Sprite.FixedY

  • Awesome suggestions, thanks! I'll try them now and report back

  • Okay, I've been a 3D artist in the video game industry fro over a decade but this is the first time I've ever tried my hand at any type of coding and am stuck.

    I've added the Instance Variable called FixedY to my sprite and set it up as Boolean, Initial Value:False...and them I'm lost

    I've gone into the Event Sheet and added the sprite I created the variable for but am not sure of the Condition to set as there are no options showing for FixedY? I'm sure this is a total beginner question but that's exactly what I am (just purchased Construct yesterday) Thanks again!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Boolean have only two state - true or false.

    You need to set Your variable FixedY as a number variable.

    Here is a link to the manual about instance variables

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