Game: Love Solitaire
I don’t
know why I called this game Love Solitaire. Original game is called
Lighting Card.
This
game story is the same as all my previous games. I found a game, I
played it a lot, I liked it very much, I made a clone. When
doing a clone I always think: can I improve the game? How? This time
I done it by removing sound. It was really annoying in the original
game.
I don’t
think that there are more similar games to this and if there are they
definitely are not called lighting card, so we will have to dive
into games rules and to be fair, not actual game rules, but my
interpretation of the rules.
Analysis
You can
win the game if you get rid of all your cards faster than your opponent.
Initially you have 30 cards in your deck and 6 more in your hand. You
can get rid of the card by dragging it to the middle row of the
table. The cards in the middle can be placed only according to the rules.
If arrow bellow the card point upwards you have to place bigger card
(eg. 11 - up, you can place 12), if arrow bellow the card points
downwards you have to place smaller card (eg. 9 – down, you can
place 8). In total there are 13 cards, so line goes like this:
1,2,3,4,5,6,7,8,9,10,11,12,13,1,2,3…
There
are four types of cards (only three in the image). Green – Wild
card is the same as joker – can be placed on any card and any card
can be placed on it. All other cards can be placed only according to
the rules. Yellow (orange?) - regular cards. Red – changes the
direction of the arrow bellow the card. Blue – lighting cards, if a blue card placed on another blue card lighting effect is displayed
and you get an additional points, if a blue card placed on any other color
card nothing happens.
When
you and your opponent do not have any cards that could be placed in
the middle, middle deck lights up to allow you to have four new
cards. If you do not have cards that you could move to the middle, but middle deck does not shine, this
means that opponent still has cards to place. But, if middle deck
shines, it does not mean that you do not have cards to place, only
your opponent does not have cards to place, so do not rush to flip
cards. Playing carefully is the way to the victory.
I do
not know how points are counted in the game, but it should
relate to the timer
somehow
. I do not like that. I like to play games as
slowly as I can. To say the truth: you can’t play this game slow,
because
opponent becomes
faster with each level. I think I won 7 levels
before it became to fast for me.
Now
lets talk about my game. I used the same card deck as in my previous
games. If people used to play solitaire they know how it goes:
A,2,3,4,5,6,7,8,9,10,J,Q,K,A,2,3... There are 4 jokers as in the full
pack of cards. The diamonds change arrows direction. And you have to get
rid of 56 cards total.
There
is no timer in my game.
There
are two modes in the game: NePo and RanDom. In the NePo mode you have
full deck and you have to get rid of it. This means that no card
should repeat (unless I made a bug in the code) except jokers which
you should have four. In the RanDom mode you have the same a mount of
cards, but all they are random so in theory you can have 56 jokers,
but its not very likely. And if you will have 56 jokers at some point
you should cry, because you wasted all your luck which you could have
used to buy a lottery ticket and became a millionaire.
In
reality it’s more likely to have no jokers at all than have a
double numbers (ten and more) of any card. So, choose the mode you
like more.
That
are the main changes. Now lets dive into the code.
Code
In this
game we have “artificial intelligence". To say the truth: we have
a lot of artificial and no intelligence. The opponent takes first card
and check if he can put it in the middle, if no - he takes the second
card and so on… You can use the same functions to check if you
and the opponent
can
place the cards in the middle. The main difference when
you do the checking. In the players' case, you need to check only when
cards collide. In the computers' case you have to check before moving a
card to find if computer has something useful in "the hand" and second time
on collision, because chosen cards do not appear instantly in the
middle and the player might have dragged some card faster than computer.
How to
make drag and collision I told in my previous article and about
sprites movement when discussing Solitaire TriPeaks. So the only
interesting part in the code of this game is: how to do timed evens.
This
code is activated with the start of the level. coTurn is a
function that does all artificial opponent moves. The timer is
stopped when level is over.
That’s easy.
I think
that this game would be really cool to play against your friends
real-time via internet. My coding skills are not up to the level to
make such kind of game. Maybe you would like to try?
You can
play the game here.