Best way to show sprite based on array
Hi there, so I'm currently learning how to make a simple 2D games on UE4, but trying to figure out how to show sprite on screen based off a click of a button. Simple principle on how I want them to work is: I have made tons of sprites for them with the following name: x-y-z. I have 6 button (2 for each set, total 3 set, previous and next). It's like if you pressed set 1 button it will move the "x" up and down starting from 0-9 and so forth creating tons of possibilities like 1-2-1 or 9-1-2 and so forth.
What I have tried: make an UMG Widget, render them to the viewport and currently only have two working buttons, the buttons to show up images with varying "x" variables. So currently it will only show 1-0-0, 5-0-0 and so forth. The "y" and "z" doesn't move. This is achieved by creating the functions for every sprites I have. Imagine I have to set such a combination from 0-0-0 to 9-9-9?
What I am trying to ask: Are there any easier way to do this? I know that UE4 doesn't have any image arrays (from most of the tutorials I've watched there is no image arrays and haven't seen anyone trying to bother to do what I'm trying to learn).
Thank you in advance and sorry for my bad language, I am not a native English speaker. Also sorry if I were to confuse you, I am starting to learn UE4.
I was thinking about that i came with two ideas: 1) Create a array from Texture2D objects, and place them as 0-0-1, 0-0-2, ..., 9-9-8, 9-9-9. Then when you click button it will add a 1, 10 or 100 to int, and also it will trigger the change event -> when button pressed, you will switch image to current number.
2) Make 3 variables to each of buttons and set them to add or substract number. Set array of all images you have. Then, combine those variables with append and go with function like this: Switcher . Also, set up the event that will switch image to found one.
answered Feb 15 '19 at 01:40 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here