Jump to content
frayt

character map for each instance on construct 2

Recommended Posts

 

hi,

I'm working on a shooter game in construct 2 and I have some problem with character map that I don't understand how it works. 

Sans titre.png

as you can see on the screen, when I click on the ennemy , I want them their faces explode by changing the character map which will change the head of the ennemy that'I ve clicked on.

but here is the problem, construct 2 change the head of all instance that has been created when I click over one instance of EnnemyFamilly.

how can a fix that? 

 

thank you

Share this post


Link to post
Share on other sites

I don't understand why you're messing with values.. it should be: if its clicked=set its character map. no variables or anything needed at all.

When learning something new, always start by getting the simplest possible version of it to work, THEN start adding complexity as needed.

Share this post


Link to post
Share on other sites

if its clicked=set its character map " Of course I do but this event doesn't work

I think I didn't explain clearly.

I have 10 ennemy that appears.

I have a mouse and when I click on one of this ennemy, I want him his head explode => that's the character map, and those that or not clicked, I want them with their whole head

but with what I 've tried, when I click on ennemy, nobody have their head explode or every 10 objets have their head explode

 

What you have to know is that each 10 objets are created from one scml. 

 

 

Share this post


Link to post
Share on other sites

Very happy to help. In hind sight, I'm very sorry if my replies seemed at all short tempered or impatient. I'm old and have a bad habit of using all-caps for emphasis (forgetting it represents yelling) and my replies were overly abrupt because I was short on time, ('tis the season to be spread very thin ;) )

best of luck with your project.

Cheers.

Share this post


Link to post
Share on other sites

Hi Mike,

 

I am having a similar problem... but I am missing the solution to this one?!

If it's ok, I will send you my zipped project.

The charMapTest_2.capx works as expected. But charMapTest_multistar.capx does not... the plan is to have each sprite look differently. (turn one star into a red one in my example).

I have looked through posts for hours but I did not find any answer that helped me...  8-(

 

So your help would be most welcome :-)

Cheers

Olaf

charMaps.zip

Share this post


Link to post
Share on other sites

Another thought:

You mentioned somewhere that for "optimization" reasons it would be better to have separate characters instead of using char maps

to vary the looks of sprites.In my case I will have partially different looking chars (like different shirts and caps) but with the same animations... so having different characters seems to me like unwelcome redundancy:

1) regarding animation logic

2) regarding images to be loaded

..so where is the "optimization" that I don't see?

Cheers and many thanks indeed :-)

Olaf

 

Share this post


Link to post
Share on other sites

Your issue was you weren't actually pairing each star box sprite with each star Spriter object while creating them. I created an instance variable in the spriter object and on in the green box sprite and named them both "WHICH"

 

During the loop that creates them I set the WHICH  for both objects to the loop index number.

 

This way each set that is created always share the same "WHICH" value, based on the loop index in which they were both created.  I can then simply compare "WHICH" values whenever I need to single out which star Spriter object belongs paired to each green box sprite.

https://www.dropbox.com/s/8rm509nbmpidn7b/multistar_FIX.zip?dl=0

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...