Wick Memory Game - Tutorial

Here I made 8 different cards inside a card clip object. Just for fun, Is there
anyone that wants the challenge to program a memory game with it?

image

It has 14 lines of code already to clone the card 16 times and place it in the right place…
image

Here is the wick file: (Initial Version)
WickMemory12-4-2020_22-56-53.wick (178.5 KB)

Completed Version:
WickMemoryOOP.wick (229.4 KB)

1 Like

what does line 11 do? does it put itself into the array?

I think it’s for the programmer to finish

i made the animation smoother and made the cards flip upon mouse click with randomized items inside. there are only 2 of each item.

next steps: make cards flip back when 2 are revealed, remove feature of clicking to hide cards

Screen Shot 2020-12-04 at 7.59.26 PM

BaronWickMemory12-4-2020_7-58-25PM.wick (175.7 KB)

1 Like

I just noticed your moderator now. Congrats!

1 Like

congratulations on becoming a moderator!

1 Like

Ok, just as a tutorial and as an exercise, I’ll try to define this simple game using Object Oriented Programming. There are multiple ways to make this simple game to work, and some would say that OOP is not required for a small game like this (which is right as well). Anyhow, here is one approach and I think that someone could complete it with this design.

I’m defining the following 3 Classes:

  • GameManager
  • CardDeck
  • Card

Lets start with the the Card class:

Card

The Card object contains 2 main properties, the card clip, and the cardValue. The cardValue represents the drawing inside the card. Example the cherries drawing could have a value of 0, the grapes a value of 1, and so on…

As per Methods/functions, it only has the constructor() and the update(). When a Card object is instantiated, it will clone the stageCard clip which is in the stage initially. At that point the cardValue must be defined by the caller/object creator, which in this case will be the CardDeck object.

Here is the current class:

Lets continue with the the CardDeck class:

CardDeck

The CardDeck object is in charge to create/instantiate all the 16 cards and place them into the game stage accordingly. It also shuffles and assigns the card values. The 16 cards will be store in a cards array.

image

As per public Methods/functions, it has createCards() which is in charge to create, shuffle and display the cards in their respective positions, and update() to run the update of all the Card objects store in the cards array:

image

And, last but not least, the GameManager class:

GameManager

The Game Manage is in charge to maintain all the main logic of the game. It will create/instantiate the CardDeck and also it will maintain the game states.

This class is incomplete, what is missing is that it should manage the main logic of the game based on the following states:

Here is the current wick file… @awc95014, this is still using your shuffle function and approaches, I put all this code in top of what you did last night.

WickMemoryOOP12-5-2020_8-02-01PM.wick (176.0 KB)

2 Likes

I completed the GameManager, the game is playable…

WickMemoryOOP.wick (229.4 KB)

3 Likes

wow this is really great. A while back I wanted to do this in wickeditor but I felt a bit discouraged. I did end up doing something similar with vuejs, but this is definitely helpful. I am going to take some time and explore this, defiantly will inspired future little fun games.

1 Like