Two core mechanics I'm trying to figure out

Hey guys,

So I’m completely new to flowlab and not very experienced at programming in general, and I’d appreciate your help in brainstorming ways of making two somewhat similar core mechanics of the little project I’m working on here happen.

The first one is a dynamic menu which appears if the player clicks and holds anywhere on the screen without moving the mouse and displays the icon for every relevant item of a given type from the inventory with the amount currently owned overlaid on top of each, placed in a circle around the mouse. The circle will gell bigger or smaller to accommodate the number of items displayed. Once the menu opens, everything but said menu is paused and the player can click the item(s) they want to use however many times they want to add more of a given item, press a reset button to bring the count of every selected item back to zero if they made a mistake in the selection, or press a “done” button which prompts a confirmation and if confirmed uses those items.

The second one is a grid which appears from the moment the player clicks, holds and drags the mouse on the screen. This one doesn’t pause the game and it registers which grid squares the mouse passes over first, second, etc. leaving a visible trail, as well as having a “done” and a “cancel” button. Once a pattern is drawn and the done button is pressed, the game searches a database (array?) for a matching pattern and executes the corresponding function or a default function if there is no match.

I hope I’m explaining this clearly enough for you to get a clear understanding of what I’m trying to do. I’m just starting to work on these and already encountering issues since I’m not used to the tools available in this engine and to the way in which they work together yet. Right now I’m trying to figure out how to check for the press, hold and don’t move the mouse condition, which I thought would be done this way but it doesn’t seem to work:

flowlab

Thanks in advance!

If you’ve started on the game and coding, send a link to the game so then I can see what you’re talking about

I’ve only made the movement and item pick-up bits so far so there isn’t much to show, but here’s the link:

http://www.flowlab.io/game/play/1038621

Bump - I’d like to put some time into the game this weekend so I’d really appreciate it if some experienced users could tell me how to achieve those results.

Thanks!

That click and hold thing doesnt need a mousemove, instead use out

That triggers when the mouse comes off the button

Ok, thanks, but I’m not sure if I understand how this works. This menu is to be displayed whenever the player clicks and holds for say 2 seconds without moving the cursor in relation to the device’s screen, not to the game world, with a little buffer on each side to account for the hand trembling. This must happen no matter where he clicks, what game object happens to currently be at that position or if the character is in motion. What’s that button which the mouse would be moved off of?

@Akninshar okay, from the way you worded that it seems like you put the button in the game world layer…

Consider using the GUI layer, which doesnt scroll with the world…

if you rapidly press space button, you go flying

I’m doing some work on your second feature here if you want to take a look.
I’m unsure if I’ll be able to implement your database idea, since I have a lot of schoolwork to do.

Hey @gravestone2260, happy that the thread caught your attention :slight_smile: I’ll take a look at what you’re doing and hopefully understand how it works – thanks! If you’re curious about how the mechanics I described will be used or about the project in general, I’d be glad to chat with you. It would be great to team up with someone with a better understanding of this engine to move the project forward, no matter the rate of progress, so let me know if that’s something you might consider.

@Akninshar I’ve got something working that will highlight grid squares if you click and drag over them. Is that what you had in mind when you said you wanted a trail behind the mouse?

@gravestone2260 Yes, the idea is for the player to be able to draw and for various effects to occur depending on what is drawn. This can be done with a mouse, but ultimately the game is designed for mobile.

I can’t test mine on mobile unfortunately since I’m on free version. I’m waiting for Unity visual scripting (sorry grazer).

He’s probably just glad that you chose to start with this engine first

@MagmaDude100 I can’t speak for him but I sure am :wink:

@gravestone2260 I’ve got the paid version so I can test on mobile.

Edit So I’m trying to run the game from mobile but I guess since I’m not the owner I can’t publish it and will have to integrate your UI into my game to try it out. First, however, I’ll have to figure out what it is exactly that you’re doing. I finally have a bit of time today to look at it, but it seems that a good portion of your file is locked so I can’t see it.

From what I can see, you’ve basically covered the functions I want and I’d just have some tweaking to do to be able to use it the way I need to for this game:

This UI (as opposed to the other feature - the menu - which I also described in my initial post) wouldn’t display after a set time. It must instead appear as soon as 1) the click is held and 2) the cursor then moves more than 5px in any direction, starting to draw from whatever location the cursor happens to be at when those conditions are met. The grid doesn’t have a limited size so it basically covers the entire game window and the player can start to draw from anywhere.

If, instead, the click is held without moving the cursor (that 5px buffer I mentioned prevents this from activating by accident when the player’s hand is just shaking a bit), then after 1 sec the above-mentioned menu will appear.

Those two features work together so that the player can either
-press and hold to get the menu to display, select a menu item which will modify the next drawing’s result, and then start to draw and/or

-make part of the intended drawing and then release the click and click-and-hold again to get the menu to appear (without having pressed the drawing’s “ok” or “cancel” buttons), so that the menu will appear overlapping the drawing and allow the player to pick a new menu item which will affect the drawing from that point on.

Does that make sense?