How To NOT Load Sprite If Collected/Destroyed?

Get help using Construct 2

Post » Fri Sep 20, 2013 3:13 am

Yes 'IsCollected' instance variable true/false on the coin with Persist behaviour sounds gooooooood
B
45
S
15
G
73
Posts: 2,007
Reputation: 43,396

Post » Fri Sep 20, 2013 3:17 am

yes Plinkie---however if you use the Persist behaviour--you don't even need to have an instance variable at all! That's why I like that behaviour--it's all built in.
B
19
S
6
G
3
Posts: 9
Reputation: 1,755

Post » Fri Sep 20, 2013 8:16 am

@honeben

I never used the persist behavior and I have a habit of doing most of my C2 stuff with variables as they tend to always do what I want of them, so when thinking of how to do something without having the program open in front of me I default to Boolean variables.

Always multiple ways to achieve the same results in C2

Another way would be to have an invisible "coin spawner sprite" at the locations of all the coins with a variable on the spawner and

At start of layout >
    For each Spawn sprite>
             Spawn sprite "collected" = false > spawn coin.

then on collision with the spawn sprite set the variable to true so when the layout restarts the coin no longer spawns.BACLog2013-09-20 08:20:44
B
25
S
7
G
1
Posts: 83
Reputation: 2,550

Post » Fri Sep 20, 2013 8:40 am

Ah yeah I guess you can just set to invisible or destroyed when collected and if it's Persist it remains gone
B
45
S
15
G
73
Posts: 2,007
Reputation: 43,396

Post » Fri Sep 20, 2013 12:04 pm

Yes, Persist has one hangup, in that when objects present on the layout on startup are destroyed, the object is gone even on game restart. (not a problem if they are all spawned by the events.)
B
226
S
60
G
33
Posts: 902
Reputation: 39,989

Post » Fri Sep 20, 2013 8:40 pm

Thanks folks for the feedback, will be testing the methods today.
B
5
Posts: 11
Reputation: 247

Post » Fri Sep 20, 2013 8:45 pm

So Far Persist Seems to Work Very Good for our game.

Thank you again for all feedback. I didn't even notice this behavior, C2 is great with all these behaviors! It makes it so much easier to create games.
B
5
Posts: 11
Reputation: 247

Previous

Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot], leandrogenske, R0J0hound and 9 guests