How do I convert an array cell to a string?

0 favourites
  • 3 posts
From the Asset Store
A collection of a mix of percussion and orchestral string loops, including 20 musical sketches.
  • Hey everyone!

    Currently, I'm trying to make a game where a bunch of sprites follow my player's position. I've created the events below by using the "Follow Player" project example on the start page as a reference.

    One of the issues I haven't been able to solve is converting my player's animation (recorded in the "animation" array) to a string, so the characters that follow him also replicate the animation.

    I've tried the solution below, but the following sprite (Player2) won't ever change its current animation. I've checked the debug mode and the animations are indeed being recorded to the "animation" array.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The issue is unlikely to be with converting to a string because it's already a string. I would debug this by first trying it without removing and inserting rows every X seconds, a basic insert a value and see if the player changes animation. If that doesn't work then you probably have other events that overrule the setting of the player animation. If it does work with the above then likely the problem is when you pop the array and set the animation in the same tick then maybe the rows move so the animation is at row 8 instead. Think about adding the logic you have there into one event or function to minimize bugs.

  • The issue is unlikely to be with converting to a string because it's already a string. I would debug this by first trying it without removing and inserting rows every X seconds, a basic insert a value and see if the player changes animation. If that doesn't work then you probably have other events that overrule the setting of the player animation. If it does work with the above then likely the problem is when you pop the array and set the animation in the same tick then maybe the rows move so the animation is at row 8 instead. Think about adding the logic you have there into one event or function to minimize bugs.

    Thank you, your answer helped me find the issue! It was indeed working, my mistake was not checking if Player2 actually had the same animation so it could replicate it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)