Hi, I’m trying to make this button darker when the player presses it with Left click, but not releases. When the button is released, the image appears, so I just want it to change color when it’s pressed. I already made a separate animation for it but I don’t know how to program it. When I use condition “Left mouse button is down” it doesn’t show the image after releasing it.
For any assistance with the engine or game topics, please provide at least the following info at minimum:
- What you’re trying to accomplish (You’ve basically covered this)
- What you’ve already done, including a screenshot of events. (No camera photos of your monitor, please)
- What you expect to happen
- What currently happens (if applicable). (you’ve already covered this)
People won’t be able to help you troubleshoot without these items in full.
Okay so maybe I should also add that I’m making a memory game following the official example, and it’s kinda in style of classic Minesweeper
Every card has 3 animations: back, click nad front. Firstly, they’re all facing back and I want them to change the color when the player clicks on them or holds the left mouse button (like in Minesweeper). That’s the “click” animation. When the mouse button is released, it should change the animation to “front” and show the uncovered image.
Right now with this setup, when I click the card, it is stuck on “click aniamtion” and I actually can click all the cards, as if it ignored all other commands below
Your animation cannot be both “back” and “click” at the same time. All subevents take parent event’s conditions into account as well.
At minimum, from a quick glance you need to do the following:
- Drag the 3rd event in your screenshot (currently a subevent of the 2nd event in your screenshot) left to make it a subevent of the first event.
- You PROBABLY don’t need the “animation of the cards is “click”” in the conditions, bec ause you’re already comparing mouse button “released” vs “down”. I wouldn’t change this until at least fixing the above first and testing.
Hi, thank you for your help! This kinda worked, but now when I hold LMB and drag it around the board, I can change all the cards to “click” and they don’t go back to their “back” state.
This how how the events look right now:
You want to add a
trigger once while true condition to this event :
Unfortunately this didn’t do anything, the problem still persists. I also tried to add this condition to the event above and also did not work
You should separate the animation from the rest of your logic.
It should basically be as a separate event:
Animation of cards is "click" (outside of or) | Change animation of cards to "back" OR | Mouse is released | Cursor/touch is on Cards |
This means “change to the back animation for ANY cards that are in the click animation, if the mouse isn’t over it OR the mouse has been released” that way if you slide across multiple cards it will release them immediately.