Change character+animations when item is collected.

For questions about using Classic.

Post » Sat Sep 26, 2009 7:10 am

I cant seem for the life of me to figure this one out. It seems like it would be so simple yet its not Heres what i need help on. In my game, the character starts off with nothing. As u explore the terrain, u find powerups to help advance u. Its in the vein of Metroid and Castlevania SOTN. I need to make it that when u get the new item (in this case, a gun) ur sprite changes to the one with a gun i have made up. Ive tried EVERYTHING and cant seem to get it to work right. Heres the CAP. Please help me. Much appreciated. Thanks.


[url:19cqgwbz]http://www.mediafire.com/?sharekey=0c61fdebdb549b505bf1f12f1ff3f30ae04e75f6e8ebb871[/url:19cqgwbz]
B
2
G
3
Posts: 21
Reputation: 892

Post » Sat Sep 26, 2009 8:48 am

This is how I would do it, for each different character type (no gun, with gun etc.) give them all the same family. Then replace all your coding for charlie with family object, which will make it so that all of the character sprites are doing the same thing.

like this (i replaced 'charlie' with the family 'friedly'):



then you just need some events (maybe a global variable)
when character = 0 then make charlie visible and charlie gun invisible
character = 1 make charlie gun visible and charlie invisible


that's just a way to do it I guess.
B
134
S
65
G
16
Posts: 1,765
Reputation: 19,188

Post » Sat Sep 26, 2009 4:57 pm

Thanks for the reply. I did what u suggested but failed... I donno if if it just didnt work (cause it sounds like it should work) or if i messed up somewhere. Heres the CAP of what i did. Maybe someone can fix it or point me in the right direction. Thanks again. :)

[url:22pcs8dm]http://www.mediafire.com/?sharekey=0c61fdebdb549b505bf1f12f1ff3f30ae04e75f6e8ebb871[/url:22pcs8dm]
B
2
G
3
Posts: 21
Reputation: 892

Post » Sat Sep 26, 2009 6:32 pm

This is way over my head, I tried to make it so when charlie touches "Gem" his sprite is destroyed & Charlie W/ gun is created where "Player" is. But that doesn't work because you have Player and Charlie in a container so they're both destroyed when I just try to destroy the Charlie sprite. And I can't uncontainer them because a lot of the coding you did for it needs it. I never use containers because this kind of shit happens and you have to start all over. The easiest thing to do would be to create a sprite called "gun" and when weapon=1 set "gun's" position to charlies hand so it looks like he's holding it.
B
7
S
2
G
3
Posts: 139
Reputation: 2,331

Post » Sat Sep 26, 2009 8:15 pm

I had trouble figuring this out at first, but then fired up your game in the debugger to see what was going on. On startup, I see that 1 instance of Charlie sprite is created, but no instances of Charlie_Gun is created. That is because Charlie is in a container with the player (red square), but Charlie_Gun is not.

So the solution is to add Charlier_Gun to the player container. And everything works!!! you still need to fix some shooting issues, but the game is looking good!!
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Post » Sat Sep 26, 2009 11:32 pm

[quote="scidave":33oxlnyt]I had trouble figuring this out at first, but then fired up your game in the debugger to see what was going on. On startup, I see that 1 instance of Charlie sprite is created, but no instances of Charlie_Gun is created. That is because Charlie is in a container with the player (red square), but Charlie_Gun is not.

So the solution is to add Charlier_Gun to the player container. And everything works!!! you still need to fix some shooting issues, but the game is looking good!![/quote:33oxlnyt]

THANK U! Ur the man! Something so simple overlooked. Ur a life saver man, thanks alot again. I really appreciate it. Thanks to all the other too for helping. This community is great. :D
B
2
G
3
Posts: 21
Reputation: 892


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests