Problem with card game

Get help using Construct 2

Post » Sun May 25, 2014 11:34 am

Hello everybody, I am developing a card game and I have a problem, maybe trivial: I created some spawner objects that generate themselves an object (let's call it "Global") that has an animation with several frames. Global object is the entire hand of a player.
I need to create the following condition: if the Global object (that is the player's hand) has some certain frames (e.g. frame 3, 5 and 7), an event will activate.
So, I set the condition:

(Global) Animation frame = 3 & 5 & 7

The problem is here, because the game recognizes the first frame (3) and the event is already active, while I need the event to be activated ONLY if there are ALL 3 frames, not only the first.
How can I fix this? Thanks in advance! :D (and sorry for my bad english)
B
6
S
1
Posts: 4
Reputation: 435

Post » Sun May 25, 2014 6:59 pm

Instead of "Global" how about we call it "Card" since that is more descriptive and less confusing since global already has uses in C2.

And just to restate the problem: you want to know when three of the cards have those 3 different animation frames.

Do to picking we can't just have multiple "compare animation frame" conditions in one event and have it work like we want. We can make make a function to do this though as it doesn't affect picking.

So you could do something like this:

On function "hasCard"
Card animation frame = Function.Param(0)
--- set return to 1

System compare: Function.Call("hasCard",3) & Function.Call("hasCard",5) & Function.Call("hasCard",7) =1
--- Do something
B
92
S
32
G
109
Posts: 5,291
Reputation: 70,993

Post » Mon May 26, 2014 4:52 pm

It works perfectly, thank you so much!
B
6
S
1
Posts: 4
Reputation: 435


Return to How do I....?

Who is online

Users browsing this forum: Euduardo and 25 guests