Can I please get some help? I've been working on this problem for 3 flat days, I've tried searching everywhere on the internet to try and find something that can help me do the same thing I am after and I can't seem to find it.
Here is what I have:
Just to explain what's going on here: I have a 1D array. It is listing a fire or a money bag that appears in the game. The fire and money bag appear at random. The elements in the array are being pushed back on the X axis whenever a money bag or a fire is created, so in the screenshot you see here, number 6, which says "Fire" was the last thing that was spawned in the game. The game will continue to increase the size of the X axis for each thing that is spawned in the game for example, the next thing that appears will be at 7, then the next at 8 etc.
In the game, I want to be able to display this a very specific way, and this is how:
Where X will display whatever the text at it's co-ordinate is.
The idea is getting those next and previous buttons to function. If I press next, and I'm at X1, it should go to X2, then if I press it again, it will go to X3, and so on down the X axis. I only want it to display the one X, not more than one.
And I've tried to do this by doing the following code:
So here is my problem:
This code allows me to go to X2 from X1 (which displays the word Fire), but it will not go further than that. I know I could just copy the code from +1 to +2 and so on and so forth, but that will mean that the player will only be able to view a limited amount of X, I don't think that's the answer, and I don't want to do it like that because the game is designed to extend the X axis indefinitely.
I've tried countless possibilities with this, and I'm having trouble getting it right. I can't remember everything I have done, however, this is the closest I am able to get it at the moment.
If anyone can help get my Next button to work, I would really appreciate that. I can then apply an opposite formula for the previous button and that would resolve my problem.
Your help is much appreciated, and I mean really appreciated. If you like, I'll be sure to provide a 'Thanks to [Your Forum name]' message somewhere in my game if you help get it right for me.
Thanks bunch! =]