How do I get my top menu to auto hide?

Get help using Construct 2

Post » Fri May 16, 2014 3:11 pm

Hey guys,

So I'm working on a traditional point n' click adventure game. I have set up a inventory bar that the user can slide down to reveal the inventory items and I would like it to autohide when it's not being touched after a some seconds.
For some reason, the way I have it set up now, it only waits the first time I pull it down. Every time after the first one, it just automatically hides as soon as I reveal it. This is what the event looks like right now:

Image

Any ideas on what I'm doing wrong?
Thanks!
B
8
S
2
Posts: 39
Reputation: 1,492

Post » Fri May 16, 2014 3:49 pm

I'm not sure why your method is not working but I would suggest not using the Wait action for this kind of event. As it is, your method simple says, as soon as the player stops touching the menu, wait 5 seconds then move up. Not if the player has not touched the menu for the past 5 seconds, move up.

Instead, use a last touched variable to store a time value and update it every time the menu is touched. Then, your event would just look to see if current time is > lastTouchedTime + 5 seconds.
B
40
S
12
G
11
Posts: 331
Reputation: 7,752

Post » Fri May 16, 2014 6:11 pm

Here is a simple capx example for you to look at.
You do not have the required permissions to view the files attached to this post.
B
40
S
12
G
11
Posts: 331
Reputation: 7,752

Post » Fri May 16, 2014 6:57 pm

Sorry Frag! I posted another message before because I was misunderstanding your explanation. But gave it a go and it's working perfectly now :) Thanks!
B
8
S
2
Posts: 39
Reputation: 1,492

Post » Sat May 17, 2014 5:10 am

No worries. I saw your post so I came on to respond but, by the time I hit submit, your post was already removed. Glad you got it working though.
Last edited by FragFather on Sat May 17, 2014 8:31 pm, edited 1 time in total.
B
40
S
12
G
11
Posts: 331
Reputation: 7,752

Post » Sat May 17, 2014 8:42 am

wrongtarget wrote:Hey guys,

So I'm working on a traditional point n' click adventure game. I have set up a inventory bar that the user can slide down to reveal the inventory items and I would like it to autohide when it's not being touched after a some seconds.
For some reason, the way I have it set up now, it only waits the first time I pull it down. Every time after the first one, it just automatically hides as soon as I reveal it. This is what the event looks like right now:

Image

Any ideas on what I'm doing wrong?
Thanks!

How can I use that lerp expression to make an object go from point A to B smooth?
B
20
S
4
Posts: 387
Reputation: 2,274

Post » Thu Oct 30, 2014 11:33 am

@Zathan I have made a menu that slides in smoothly (read into 'lerp' and 'dt' functions) BUT it only slides in when the game starts.

@FragFather Can anyone help with a On / off button that slides the menu In and Out?


(the attached example also includes a card match game with snapping)
You do not have the required permissions to view the files attached to this post.
B
15
S
6
G
3
Posts: 87
Reputation: 4,304


Return to How do I....?

Who is online

Users browsing this forum: banquetburger and 18 guests