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

Get help using Construct 2

Post » Thu Oct 23, 2014 3:20 pm

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?

Image
B
7
S
1
Posts: 27
Reputation: 511

Post » Thu Oct 23, 2014 3:36 pm

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

viewtopic.php?t=68074&start=0#315769
B
7
S
1
Posts: 27
Reputation: 511

Post » Thu Oct 23, 2014 3:59 pm

Didnt help, just jumps between the start and endY values.
B
7
S
1
Posts: 27
Reputation: 511

Post » Thu Oct 23, 2014 4:06 pm

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.
B
71
S
30
G
25
Posts: 984
Reputation: 19,503

Post » Thu Oct 23, 2014 4:58 pm

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?

Image
B
7
S
1
Posts: 27
Reputation: 511

Post » Thu Oct 23, 2014 6:27 pm

Can you perhaps isolate those events and objects in a capx for me to look at ?
B
71
S
30
G
25
Posts: 984
Reputation: 19,503

Post » Thu Oct 23, 2014 6:37 pm

Be happy to, just getting a bite to eat, will sort it out later tonight. TVM.
B
7
S
1
Posts: 27
Reputation: 511

Post » Thu Oct 23, 2014 7:41 pm

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.
You do not have the required permissions to view the files attached to this post.
B
7
S
1
Posts: 27
Reputation: 511

Post » Thu Oct 23, 2014 7:55 pm

Problem comes from your t variable. It needs to be reset to 0 upon completion of the show/hide animation.
B
71
S
30
G
25
Posts: 984
Reputation: 19,503

Post » Thu Oct 23, 2014 8:25 pm

Brilliant! The file attached works perfectly, thanks very much for your help.
You do not have the required permissions to view the files attached to this post.
B
7
S
1
Posts: 27
Reputation: 511


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, brunopalermo, Phacanu, richcoz81, Txchaser, Yahoo [Bot] and 27 guests