How was made


Well this is the how it does.


To be honest this game was made in only 2-3 days, was the free time i can take from work and other things e.e


The idea was a game like Rock, Papel and Scisors. But more complex, where some cards automatically wins andothers depends of others values.


So, with the cards are 4 tipes

1-Plants

2-Herbivore

3-Carnivore

4-Omnivore


But decided to add the extra values like size and endurance.

Size will be used to take in mind if the carnivore can eat another carnivore or omnivore.

Endurance is to check what cart will survive longer without eat, the first to die lose the round.


that was the mechanics with this card game, so pass to CODE.


I create the Class card, that will contain the info, the card will change with this data.

a simple class to save the info.


Later comes the creatin of all the card:


here we create all the arrays need it to pass each data to all the cards, and add this cards to the STATIC CLASS DATA, so i can get a random card each time i need with all the info i required.


here comes the art part, must have a different color for each type of card and the symbols for that type of card too

Plants are yellow card with the lant symbo

Green are the herbivores with the eat plants symbol

Red are the carnivores with the eat animals symbol

Blue are the omnivres whit the eat plantas and animals symbol.


with this card ready comes the put data on it, and come the other code of info


the process card is called when start the game and when the object is enable.

this process is like that because, at the start of the game the 5 cards are picked randomly so you have your hand ready, but when you chose a card the card is disable, so when i enable the card again this will automatically pick another random card from all the cards.


With the IA is the same, just that the IA cards are upside down, so you can see what the ia pick, here are no strategy, is a lucky game, so try your best to send the winner card of each round.


There are two process until the hard part of the creation of this game comes.

1 - You can see and pick your card (wait until you chose your card)

2 - The IA randomly pick a card from its hands card (wait until the ia chose)


When both of you picked a card comes the hard part.

The process where compare the cards and define who is the winner in the round.



Here is the process, this methot only starts when you and the ia picked your cards, the first tempo is for the animation entry, so the cards will enter to middle of the scene biggers. The second tempo comes to the really hard part, where where check boths cards and see who is the winner and adding the particular effect and sound to the loser card. And final is the exit of the cards and restore data so this process will start again by chosing the card of the next round.


here are more of this checker code

this methods are for effects, the skull is used for cards that die by endurance, tie effect is when both cards are the same or have the same data in a particular case adn hit effect is for the eaten cards, one for the plants and other for the animals.

there is another part of this code, is the check card, that is really really long, why?

because is something like this

switch (type card1){

case 1:

     switch (type card2){

     case 1:

     break;

     }

break;

}


the cards are a process of two switch cases, depending of each type of combination is a different way to win or lose that round.

here are the explanation directly without the giant code xd


Plant - Plant (Compare Endurance value to chose winner)

Plant - Herbivore (win Herbivore)

Plant - Carnivore (Win plan by higher endurance values)

Plant - Omnivre (win omnivore)


Herbivore - Plant (win Herbivore)

Herbivore - Herbivore (Compare Endurance value to chose winner)

Herbivore - Carnivore (win carnivore)

Herbivore - Omnivre (win omnivore)


Carnivore - Plant (Win plan by higher endurance values)

Carnivore - Herbivore (win carnivore)

Carnivore - Carnivore (Compare size value to chose winner)

Carnivore - Omnivre (Compare size value to chose winner)


Omnivre - Plant (win omnivore)

Omnivre - Herbivore (win omnivore)

Omnivre - Carnivore (Compare size value to chose winner)

Omnivre - Omnivre (Compare size value to chose winner)


and that is the info, was really hard to work this logic to be honest, and well the last things is the score, when some one score 10, the game is over x3


dont post the check card function because is a really really long sequence of code XD

there was many time of my work in the game e.e


maybe there are some mistakes or something, sorry i was working quickly and was tired at the end zzzz


hope you learn something and see more of my style of coding.

Files

eco_figth.zip Play in browser
May 01, 2023

Leave a comment

Log in with itch.io to leave a comment.