Many questions about blueprints

1.) If the OnClicked node is part of Card_BP you can just use the SELF node. All actions within this blueprint will affect the current instance automatically.

2.) Sounds good to me

3.) Search for ‘linetracing’ or ‘raycasts’. Here you can find documentation: https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/UseRaycasts/Blueprints/

Especially this one:

https://docs.unrealengine.com/latest/images/Gameplay/HowTo/UseRaycasts/Blueprints/GHT2B_10.jpg

4.) You could use this macro to get a random element from your array each time when you spawn your cards: [ADD] Get Array Random element - Feedback & Requests - Epic Developer Community Forums

  1. If the OnClicked node is part of Card_BP you can just use the SELF node. All actions within this blueprint will affect the current instance automatically.

  2. Sounds good to me

  3. Search for ‘linetracing’ or ‘raycasts’. Here you can find documentation: https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/UseRaycasts/Blueprints/

Especially this one:

https://docs.unrealengine.com/latest/images/Gameplay/HowTo/UseRaycasts/Blueprints/GHT2B_10.jpg

  1. You could use this macro to get a random element from your array each time when you spawn your cards: [ADD] Get Array Random element - Feedback & Requests - Epic Developer Community Forums

Hi, first post here! Have been using this forum a lot, but these questions I couldnt find anywhere so I guess I need to make a post now =)

I am making my first attempt on a real game project, a memory game with 3x4 cards.These are spawned through looping (I only have one card_BP made, and I spawn 12 instances of it when the game starts). I want to be able to click a card to flip it around and maybe highlight it when hovered over.

1: So, I made a OnClicked node. How do I get a reference to the correct card? I mean, there are 12. Do I just reference the original card_BP?

2: What would be the optimal way to spawn these on game start? I have made a loop that spawns 12 and stores the name of each one in an array. I used some math to make each card get its position.

3: I want to highlight the one hovered over. I am thinking maybe some edge detection is in order to highlight the outline of the one hovered over. How would I go about this?

4: They need to be randomized/shuffled on each new game. Maybe they could just swap textures, whichever is easier. They should also be “paired”, by that I mean there should be 6 pairs where each pair has identical texture.

These are the most pressing questions I have on the process of making my game, but I’m sure I’ll have more questions later =)

Thanks a lot =)

Hey! Thanks for your reply.

I have just gotten around to trying the first problem. The solution works, any card I click now turns 180 degrees. However, I need them to turn back when I click them again. Any idea how to do this? I tried this:

Also, I am just now realizing the game logic will need to know which two cards are identical. Like I said earlier, there will be 6 pairs of cards where each pair is identical and the objective of the game is to find the pairs. But the game needs to know which cards “belong to each other”. So, how can I do this? Do the cards need to be tagged somehow on spawntime? Anyone have some ideas for this?

I would suggest to just ‘link’ two cards together (just save a reference to the ‘partner card’ as a blueprint variable when spawning them and then check if the other card == ‘partner card’. You also could create a simple function like

isPartnerCard(otherCard):boolean

where you check if the image of the current blueprint instance (self) == the image of ‘other card’ and then react to it.