memory game randomizing card faces

Get help using Construct 2

Post » Thu Jul 26, 2012 6:15 pm

Ok, add a new event:
System:compare tickcount=1

And move event 9 (the for each ordered) to be a sub event of that new event.

What was happening was destroyed objects still exist until the end of the frame. So there was still an odd number of cards when the for each was run.


As for being able to match different cards I suspect your condition that checks for a win may be the cause.
Try changing the expressions to just gFirstCardFrame=gSecondCardFrame
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Fri Jul 27, 2012 3:47 pm

thank you so much, youre a freakin genious
B
2
Posts: 9
Reputation: 268

Post » Thu Feb 19, 2015 11:13 am

Hi @R0J0hound ,
sorry for asking this on this old post but i found your deal_pairs.capx much better to understand using arrays as i can actually 'see' how
the cards are laid out, which is what i want. Unfortunately @kittiewan hasn't been on for a year (to ask) so i used some of her code from the tutorial
so i am able to remove and destroy the pairs of cards i click on.
Where i'm stuck is how, using the array, to just so ALL "facedown" cards to begin with. At the moment they're all faceup and your capx is definitely a quicker
way to do it also. Do i need to create another array using a different card object, animation frame 0, and use there IIDs to select those and remove
them from the TOP of the array by Ids? :?
Any help on that would be appreciate. Read the manual, and Kits tut, but cant workout whether i need a separate array of "facedown" cards to appear
ontop. Thanks,
Rob
B
14
S
2
Posts: 19
Reputation: 819

Post » Thu Feb 19, 2015 5:57 pm

Instead of setting the animation frame, you can set an instance variable of each card. Then you can make a boolean variable for each card and call it "face up". If the boolean is true you set the animation frame, and if it's false change the animation to a face down animation frame.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Fri Feb 20, 2015 2:21 am

Thanks for quick reply R0j0.
Image <- i set the card object with those variables. I just mean, as in your example, where would i put the check so that
all cards initially are face-down? I'm using Card.AnimationFrame and a few text objects so i can "see" the FrameNumber as i click on it so i can see the feedback. OK...so
i will have a think a bit more about this. If i get stuck ill annoy you again :mrgreen: nicely,
Thanks again.


R0J0hound wrote:Instead of setting the animation frame, you can set an instance variable of each card. Then you can make a boolean variable for each card and call it "face up". If the boolean is true you set the animation frame, and if it's false change the animation to a face down animation frame.
B
14
S
2
Posts: 19
Reputation: 819

Post » Fri Feb 20, 2015 8:08 am

> @Vaidd


I made this for another thread, mixing up letters of a word and mixing in "fake" ones. Check it out, it might help you too...
The randomizing principle can be exactly the same in your case.


download/file.php?id=12316
You do not have the required permissions to view the files attached to this post.
B
8
S
3
Posts: 197
Reputation: 1,207

Post » Fri Feb 20, 2015 10:17 am

Hi mate,
Thanks @Vaidd will take a look at it to.
The R0j0 random example is great, its 90% what i want and i have the cards deleting etc, just not facedown at start.
Its all new to me LOL. I come from a RAD framework which was built on Delphi so the flow IS a little different in the event structure,
After 2 weeks so far I'm understanding it more and more and a helpful forum goes a long way :)
Thanks
B
14
S
2
Posts: 19
Reputation: 819

Previous

Return to How do I....?

Who is online

Users browsing this forum: Magistross and 2 guests