frayt Posted November 9, 2016 Report Share Posted November 9, 2016 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. 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 Quote Link to comment Share on other sites More sharing options...
Mike at BrashMonkey Posted November 10, 2016 Report Share Posted November 10, 2016 You are using FOR EACH which tells it to do the action to ALL of them, and not just the one clicked on. Get rid of FOR EACH. Quote Link to comment Share on other sites More sharing options...
frayt Posted November 11, 2016 Author Report Share Posted November 11, 2016 hi, here is another try that doesn't work, I just have an instance variable in noeliste scml => OwnerUID = 0 Quote Link to comment Share on other sites More sharing options...
frayt Posted November 12, 2016 Author Report Share Posted November 12, 2016 I think I have to understand the difference between the object's familly and the object as an scml. Quote Link to comment Share on other sites More sharing options...
Mike at BrashMonkey Posted November 12, 2016 Report Share Posted November 12, 2016 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. Quote Link to comment Share on other sites More sharing options...
frayt Posted November 12, 2016 Author Report Share Posted November 12, 2016 " 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. Quote Link to comment Share on other sites More sharing options...
Mike at BrashMonkey Posted November 12, 2016 Report Share Posted November 12, 2016 please zip up your capx and your Spriter project and email it to mike@brashmonkey.com and I'll take a look. Quote Link to comment Share on other sites More sharing options...
frayt Posted November 12, 2016 Author Report Share Posted November 12, 2016 I sent you, thank you for your help skincareiml 1 Quote Link to comment Share on other sites More sharing options...
Mike at BrashMonkey Posted November 17, 2016 Report Share Posted November 17, 2016 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. Quote Link to comment Share on other sites More sharing options...
Rachmaninow Posted April 26, 2017 Report Share Posted April 26, 2017 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 Quote Link to comment Share on other sites More sharing options...
Rachmaninow Posted April 26, 2017 Report Share Posted April 26, 2017 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 Quote Link to comment Share on other sites More sharing options...
Mike at BrashMonkey Posted April 26, 2017 Report Share Posted April 26, 2017 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 Quote Link to comment Share on other sites More sharing options...
Rachmaninow Posted April 26, 2017 Report Share Posted April 26, 2017 Aha! 8-o Many thanks again, Mike, for helping out so quickly ... it nearly drove me nuts! Cheers and all the best! Olaf Quote Link to comment Share on other sites More sharing options...
Mike at BrashMonkey Posted April 26, 2017 Report Share Posted April 26, 2017 No problem. Glad to help. Also, regarding characters being in separate SCML files. I did not mean characters created via character maps, I meant characters who's animation data was also different. Rachmaninow 1 Quote Link to comment Share on other sites More sharing options...
Rachmaninow Posted April 27, 2017 Report Share Posted April 27, 2017 Ok... that settles that.. from your reply I got th idea that there was some kind of optimizing going on behind the scenes that would make the several char approach more efficient somehow. Thx for clearifying Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.