I'm looking for a "mouse clicked "event...NOT "while mouse is down" event (or "key clicked"))

I’m a newbie. I’d like to move an object a certain distance when the mouse (or a key) is pressed. But I only want to trigger that motion ONCE, no matter how long the mouse or key stays down. I can get an instant event by using mouse or key UP, but I’d like to know if there’s a (simple) way to do an instant “key/mouse was pressed” event.

Also, in either case, the object jumps to its new position instantly. I’m having a hard time making something move smoothly, and not jumping. (I’m clearly having a hard time “getting” the motion system in GDevelop.)

Most languages I’ve used have events like MouseDown, MouseUp, KeyDown, KeyUp, MouseClick (mouse was pressed and released over the same object), etc., that only trigger once. So I’m wondering how my situation would normally be handled in GDevelop. Also, is there any plan to introduce the single-trigger events I listed?



Sadly I don’t think those events will get implemented anytime soon.
What you can do though is add this to all your key pressed event:
Trigger Once.
You’ll be using it quite a lot… and it will start to get messy…

Edit: for your second question, what do you mean by jumping? Do you want something to gradually accelerate like in Pathfinding/Platformer behaviour?
If you are setting X coordinates directly, consider using Forces instead, otherwise you can use “add to” instead of “set to” for them.

Instead of using “pressed”, use “released”.

By jumping I mean that the object moves instantaneously from point A to point B; there’s no visible motion. Having it ease in and out would be nice, but for now I’d be happy to just find a simple way to have an object move from point A to point B over a set time and then stop. I will look into using “add to” as an approach.

Yep, I tried that, thanks. I’m still a newbie and despite having programmed simple (but complete) games in Flash ActionScript and HyperCard (remember that!??), GDevelop’s motion paradigm is still alien to me. I just have to flail until something “catches”… :neutral_face:

That sounds possible. Are you making a platformer or a top-down camera game though (if not, what would describe it - pictures are ok)? Would be able to guide you to use Forces, the PlatformObject behaviour, or Pathfinding behaviour, because they’re more polished to do movement.

My goal is a top down game with only orthogonal movement, no diagonal movement. I want to have a grid, maybe 10 x 15. I want pieces to move left, right, up, or down by themselves and continue moving until they hit the edge of the screen and reverse direction, or until they hit an object placed in their path (by a mouse click). Depending on where the obstacle is placed, the piece would either reverse direction or be deflected 90°. So, if moving horizontally, a piece might be deflected to go up or down, etc. The idea is that pieces will keep appearing and the player has to keep any of the pieces from colliding by strategically placing and removing these “deflectors”. Pieces are always in motion, so it will be sort of like juggling.

A further goal is to have each piece tween from grid square to grid square, sort of a pulse to each new square. In fact, ideally I want to create an animation so that the pieces look like tiles that are flipping from grid square to grid square. Like how the page of a book looks as it rotates 180° from being completely open to being completely closed as you look straight down at it.

TMI, I know, but that’s the plan. Thanks for asking.

I’m gonna miss being able to reply to well-detailed out posts like that…
Anyway, I’m still understanding what you want here, but in the meantime, open up/create the pathfinding example, untick the guy’s diagonal movement in the object behaviour, adjust the grid size to be what you expect there (10 width, 15 height?), play around with it, and see if that’s a little close to what you want.

I think what you want is one of those slidey-ice games (not sure what they’re called), but if there’s a video/images that’s most similiar, that would really help.

Cat, thanks so much for taking the time to go through my overlong explanation, and for your suggestions! I will definitely check out the pathfinder example!

Bummer if you’re leaving the forum…

Ha, no! I won’t. But when I get a full-time responsibility (that’s three letter word), I’m probably not going to reply as often as of now.
But eventually, things will stabilize, and either the community grows or I eventually have no problem replying. The past few weeks procastinating on my own game by hanging out in the forums has been both fun and educational, and honestly I’m really thankful to this community even existing.

But, that’s really another topic. Just hit up with any more questions later and I’ll do my best!