How do I create object based off a value

  • I am cross referencing 2 arrays; if the arrays values are equal I want to create an object that is equal within the arrays. Construct only allows me to create an object by actually picking a specific image/file for the object. Is there anyway I could use the string that is cross referenced as a string to create an object?

    Like if "sword" was the cross referenced item, I could create an object using "sword" for the jpg?

  • If the object doesn't have any animations to it, than it can be achieved using sprite frames. In the sprite animation frames, create as many of the images that you want. Remember their animation frame number for each of those images. You can use them as the value in your array. For example, if sword is at frame 5, than when both the arrays value are at 5, you can create the object and set the frame to 5.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I cant seem to get it to work; the animation is just going through all the animations. I have my condition set to only if the 2 array values are equal. Then I use "Set animation frame to Zweapons.CurValue.

    Even if I set it to frame 1; it still just cycles through the animations

  • That means your animation is set to be playing. Go to your sprite editor, select the animation window, than you will see a few options on the left tab. Set the loop and play to 0 and that will tell C2 to stop playing the animation and treat them as individual frames.

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