Many questions about blueprints
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 =)
asked Sep 14 '16 at 06:10 PM in Blueprint Scripting
Especially this one:
answered Sep 14 '16 at 06:26 PM
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:
4) You could use this macro to get a random element from your array each time when you spawn your cards: https://forums.unrealengine.com/showthread.php?73512-ADD-Get-Array-Random-element
answered Sep 14 '16 at 06:27 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here