How do I make my Object move on the Y axis properly?

0 favourites
  • 10 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I may be insane, but I'm using Construct to build a productivity app, part of the app contains a calendar which queries a database, I have that working correctly - and pretty jazzy it is too! What I also want is a key that slides in from the bottom of the screen, clicking on a hide button - hides the key.

    I have the movement working partially, the show_key works perfectly, but when I want to hide the object it only moves a small way and then stops. It's like its fallen out of a loop somehow.

    Weirdness ensues because I use exactly the same code structure for each function.

    I don't have a capx, but have attached a shot of the associated events. What have I done wrong guys?

  • Hah! Just found this, will see if it helps me.

  • Didnt help, just jumps between the start and endY values.

  • Events 10 and 13 in your screenshot are basically useless. They barely move the spr_cal_key, for the sole reason that they are run only once ! They don't "fall out of loop", because there are no loops involved here in fact. The "Every tick" terminology might have confused you into thinking this would run until your condition is met, but "Every tick" is actually a dummy condition that has no effect whatsoever, it simply there for those that don't like "empty conditions".

    Timer behaviors could be used to do what you want, and if using 3rd party plugins is ok with you, you might want to take a look at RexRainbow's MoveTo and lunarray's LiteTween behaviors instead.

  • Hmm, I'm misunderstanding a fundamental construct 2 concept here. I'd like to accomplish this without the use of Timers or 3rd party plugins, moving an object across a single axis is pretty basic stuff and I should be able to do it fairly easily within Construct itself.

    I've edited my code so that the code has been taken out of the function and replaced 'every tick' with 'every 0.02' seconds. Same behaviour, the initial load works perfectly, and the object slides onto the screen, but the touch based movements don't work, all I'm doing is setting a trigger variable by touch. So why is it only triggering the move Y event once and not every 0.2 secs until the Y pos condition is met?

  • Can you perhaps isolate those events and objects in a capx for me to look at ?

  • Be happy to, just getting a bite to eat, will sort it out later tonight. TVM.

  • Here ya go. As you can see, on first load the panel animates smoothly, but when you click the red bar, it pops in and out.

  • Problem comes from your t variable. It needs to be reset to 0 upon completion of the show/hide animation.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Brilliant! The file attached works perfectly, thanks very much for your help.

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