How do I make a menu (not level select)?

Get help using Construct 2

Post » Thu Oct 13, 2016 12:44 am

Trying to make an action menu pop up on click, but it's a little broken. I couldn't find any current posts on this type of menu - if there is, please point me to it.

www -dot- cazualnoob -dot- com/web-games/ (second game file)

I know the gridx and gridy are switched on create object menu1, but if they're "correct" the menu doesn't show. I'm at a loss.


Looking for:
Why the menu isn't popping up at the origin of the mouse.
Why clicking the menu (to destroy) pops up another menu instantly.
Best way to make trees solid. Not sure how to handle this in tilemapping (guessing just create an invisible solid sprite).
Any advice or best practices for what I'm doing.

Any help would be appreciated... still working on the learning curve.
B
7
S
2
Posts: 28
Reputation: 483

Post » Thu Oct 13, 2016 8:18 am

You're creating the menu at gridx,grixy instead of mousex,mousey
When you create at mousex,mousey you have an event that destroys on touch so you'll never see the menu. You should set up a boolean for opened/closed and trigger the pop up in that way.
If by solid you mean 'has collision', they already do, unless you erase the tree tiles. It really depends what you mean by solid in this situation and what you want the trees to do.
B
46
S
16
G
77
Posts: 2,155
Reputation: 45,823

Post » Thu Oct 13, 2016 9:24 am

Old school example from the "How do I FAQ"

Do a contextual menu in events - LINK
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
291
S
114
G
95
Posts: 7,293
Reputation: 70,144

Post » Thu Oct 13, 2016 1:36 pm

Message: Glitchster can only post plain text URLS until they have 500 rep. 2 URLS modified. Why?
Kyatric wrote:Old school example from the "https://www.scirra.com/forum/how-do-i-frequently-asked-questions_t63692 How do I FAQ"

Do a contextual menu in events - http://www.scirra.com/forum/context-menus-in-game_topic45453.html LINK



Yea, I saw that from my searching before hand, but I couldn't get it to work in my construct - I was just assuming the version wasn't compatible being 5 years old or me using the free version until I get farther in learning.


plinkie wrote:You're creating the menu at gridx,grixy instead of mousex,mousey
When you create at mousex,mousey you have an event that destroys on touch so you'll never see the menu. You should set up a boolean for opened/closed and trigger the pop up in that way.
If by solid you mean 'has collision', they already do, unless you erase the tree tiles. It really depends what you mean by solid in this situation and what you want the trees to do.


OK, thanks. I'll work on that angle for the menu.

Solid meaning can't pass through (behavior - solid), right now the main char (arrow keys) can pass through the tree tiles. I suppose sprites are the only way to do that.
B
7
S
2
Posts: 28
Reputation: 483

Post » Thu Oct 13, 2016 3:15 pm

Image

I did it. Thanks for the guidance.
B
7
S
2
Posts: 28
Reputation: 483

Post » Thu Oct 13, 2016 4:00 pm

Suppose that works. Although it is a bit weird.

1/ plinkie suggested a Boolean. A boolean is type of instance variable. If you gonna create a global variable 4 everything, you will (seriously) end up with a no manageable project. Moment you have 2 types of menus, you gonna be lost.

2/ This add 1 to menuopen thingie. I know why you did that. But the good practise way to do this, is just using 'else' in event 15.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Oct 14, 2016 9:11 am

The capx did work, but it required some adjustements.
Here is a version made in r237 that does the job : ContextualMenu_2016.capx
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
291
S
114
G
95
Posts: 7,293
Reputation: 70,144

Post » Fri Oct 14, 2016 1:29 pm

Right, I should have specified on how it wasn't working. I ran it in chrome, IE, and firefox and all I see is a big gray empty box that does nothing even when I click.

I even opted-in and downloaded the beta to open the newest one and it's the same.
B
7
S
2
Posts: 28
Reputation: 483


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo and 20 guests