How do I create object based off a value

Get help using Construct 2

Post » Sun Dec 07, 2014 8:04 am

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?
B
5
Posts: 18
Reputation: 261

Post » Sun Dec 07, 2014 1:10 pm

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.
B
46
S
23
G
31
Posts: 693
Reputation: 20,637

Post » Sun Dec 07, 2014 5:59 pm

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
B
5
Posts: 18
Reputation: 261

Post » Mon Dec 08, 2014 1:23 am

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.
B
46
S
23
G
31
Posts: 693
Reputation: 20,637


Return to How do I....?

Who is online

Users browsing this forum: Beatchyvon and 22 guests