Basic questions

Get help using Construct 2

Post » Tue Feb 07, 2012 11:05 am

1/ why do you have to delete frames? explain a bit more about your game and we might find out that it's not required (some control stuff can be done by events)

2/ Instances always have the same animations with the same frames. If you want to differenciate frames you have either to create other animation inside the sprite, or clone the sprite and change the animation.

But as I said, you might want to consider sharing a bit more about your game to have the best answer.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Tue Feb 07, 2012 12:07 pm

Hi Yann,

Thanks for the quick answer! So I would have to do different animations inside the sprite?

I am going to explain a little more of what I am trying to do (not very sucessfully). I am working on a small educative game, where I want to have a "tree of life" (a simplified phylogenetic cladogram of life forms).

In the end of the branch there will be a target, such as mammal, fish, fern, bird... and so on (I will have 22 classes).

I will have several images, positioned in the top left that should be then dragged and dropped to their right targets. To do this I am following the RPG Inventory Tutorial. There are some differences, I don't have a trash bin or a bag to put stuff. Also any image can be positioned in any target (unless it is already filled).

I also want to compare the id of the image with the target, to check if it has been correctly placed.

I tried to use one sprite as a array to keep all the images. What I tried to do was to, after placing one image, spawn another sprite in the next image (next frame). The problem with this is that I can't find a way to add a variable to a frame, or animation. So I could asssign the id to specific frames.

I had the idea to duplicate the sprites and there I could give them different IDs. Then I would have the same object, replicated 22 times, each one with a set of 3 frames all regarding the same image, so I could have all code done to only one sprite (if I have more than one different sprite I would have to do that for every sprite).

Maybe I could have an additional array where each position stores the ID value of each frame.

I am not sure of what about to do here. I was trying to do this with to sprites, but their behaviours are all messed up...
B
5
Posts: 10
Reputation: 470

Post » Tue Feb 07, 2012 12:33 pm

And following the previous question, how do I add values to the array?

I have set up an array, defined it as global, attributed the size to the X dimension (22), kept the others at 1. But now I don't know how to attribute a value to each slot.

Can I do this in Instance Variables, or something like that, or do I have to do this in the Event sheet?

From HERE I couldn't understand if there is a way to pre-fill the values at each slot.
B
5
Posts: 10
Reputation: 470

Post » Tue Feb 07, 2012 1:43 pm

you wanna do something like that?
cladogram.capx
Last edited by Yann on Sun Sep 14, 2014 9:41 pm, edited 1 time in total.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Tue Feb 07, 2012 2:04 pm

Don't know if I got it right, but if you want to set an object to an animation and leave at that animation frame, you can set the animation speed to 0 and then, via events, change the frame.
Also, you can add multiple animations to one same object, you don't need 22 objects with a different animation each, chech this manual entry for more info
B
83
S
21
G
15
Posts: 1,039
Reputation: 15,134

Post » Tue Feb 07, 2012 3:04 pm

@7Soul yeah you're right, that's exactly what I did
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Tue Feb 07, 2012 5:19 pm

Hi guys,
Thanks for the replies.

7soul
about animation speed and defining the frames I am already doing that, no problems there. my question was about adding a identifier variable to each frame which seems that can't be done.
Also I undesrtood the multiple animation part from Yann, but thanks for taking your time to help me! :)

Yann-
That's very close to what I wanted to do, being the difference that the one I am trying to make is a little more complex (which maybe it is not such a good idea for someone like myself with little coding experience, especially related with game design).

Anyway, the main differences are that I wanted each image to appear one at a time, since I have little space to place all the 22 images at the canvas (I am already working with 1280 x 1024 window size). So like in the RPG Inventory example (I am pretty sure you know what I am talking about since you are referred in the first sentence! :D), I wanted the new images appearing one at a time.

In the future I will try to have a set of images being shuffled and randomized every time the game starts, but for now I will be happy if I can start with them randomized but always in the same order.

Thanks for sending me that example, I will study it to see if I can use it.

My own capx is in HERE, but it is not working well:

I cannot spawn a new sprite and use it independently, because, then it applies all the new changes to all of the spite instances. I am not sure of how to solve this.

The same with the target boxes.

This is really a mess...
B
5
Posts: 10
Reputation: 470

Previous

Return to How do I....?

Who is online

Users browsing this forum: Artpunk, gregorysforster and 1 guest