Help with tile shifting game

Get help using Construct 2

Post » Sat Mar 02, 2013 9:10 am

The game I have in mind involves a grid of square tiles. I want to make it so a line of tiles can be shifted. So a row of 1,2,3,4,5 would become 2,3,4,5,1. I've been trying to come up with a way to do this, but it seems all my methods are really inefficient. Can people help me with this? Thanks.
B
10
S
4
G
3
Posts: 103
Reputation: 2,984

Post » Sat Mar 02, 2013 10:53 am

If you have the tile numbers in an array you can push the first element to the back, then pop the first element.

[1,2,3,4,5] - Starting array
[1,2,3,4,5,1] - Push first element to the back
[2,3,4,5,1] - pop the first element from the front

Push the last element to the front and pop the last element to go the other way.theubie2013-03-02 10:53:35
B
26
S
8
G
3
Posts: 210
Reputation: 5,973

Post » Sat Mar 02, 2013 6:58 pm

[QUOTE=theubie] If you have the tile numbers in an array you can push the first element to the back, then pop the first element.

[1,2,3,4,5] - Starting array
[1,2,3,4,5,1] - Push first element to the back
[2,3,4,5,1] - pop the first element from the front

Push the last element to the front and pop the last element to go the other way.[/QUOTE]

Thanks theubie. I've been doing tutorials that relate to platformers. It makes sense to have a sprite for the main character, each enemy, etc. With what I'm trying to make now though, how would I add conditions to tiles that look the same? I could add them separately and give them different names, but it seems there must be a better way. Do you see what I mean?
B
10
S
4
G
3
Posts: 103
Reputation: 2,984


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go and 21 guests