Keyboard controlls in Pairs

Hi, I was asked to do a memory match game and I took as an example “Pairs” that is in the tutorials, but I need to use the keyboard arrows to move and select the cards, not the mouse as it is pre-designed.
Any ideas or suggestions of what conditions or actions I should use?
Should I use a hidden hitbox?
Would it work if I put a joystick on the screen that is controlled with the keyboard?

I would appreciate any ideas, I am very new to this.
Greetings.

what i would do here is use a hidden card (aka make a duplicate of the card and use the hide function, by making a group called “hitboxes” or something too that effect)

and make those move instead of the actual cards

so basically if you want semi code:

if mouse/cursor is on: “card ace 1”| move “hitbox card ace 1, -60 x units”
left key is pressed |


if this isnt what you meant im sorry i cant really tell what you mean. if you want too be a bit more specific i can probably give you a better answer

1 Like

I think you can make an object with four points up/down/left/right and use those points to navigate.
If up key is pressed and the point Up is inside a Card object, move ActivateCard object to Card (position of Up point) then move the four points to position of ActivateCard.

Hope it makes sense for you.

1 Like

01


2 Likes

Thanks for the answer, it was very illustrative to be able to do something.
I followed the steps, but two things happen that I don’t quite understand how to solve:

  1. The “hand” object shows behind the cards. I modified the Z axis value but it remains the same.

  2. When I select a card, it immediately shows me the pair and matches between the two.
    What part of the code should you modify to follow the original logic of the game?

pairsgdevelop

This is how I ordered the conditions:

BTW, Thanks to everyone who responded, I was really very confused.

Both of these things don’t happen to me.
I use z-order 23.
The events for moving the hand should not be sub-events.

You’re right, now it works just like you showed it.
Just one last thing, doesn’t it happen to you that when you press a key several times in a short time, the cursor moves out of position?