Two Cat Games

presents

Perang: 3 Card Battle

Choose a class below to learn about

The Board

Picture of the Perang Board in Unreal Engine

See the full Java Board and Perang Classes by clicking the buttons below.

Java Board Class Java Perang Class Java User Interface Class

In Unreal Engine, the Board Blueprint handles the game logic similar to how the Board, Perang, and User Interface Java classes handles the game logic. The Board Java class has methods for setting cards in the slot, the coin flip to determine who starts the game, printing the board to the screen, and modifying attack and defense values in the case of a tie.

The Perang Java class handles the initial setup, changing the player turns, and checking for game over events.

The User Interface Java class handles state machines and the entire battle phase including user print outs and determining valid input.

Event Begin Play

Event Begin Play events from Board blueprint.

When the battle begins, these are the events that start up the board which ends with the 'Start Winner State Machine' event, which takes over during play.

Disable/Enable Mouse

Disable and Enable Mouse custom events from Board blueprint.

Enabling and Disabling the mouse can be done with three nodes: Show Mouse Cursor, Enable Click Events, and Enable Mouse Over Events. I find it more convenient to create custom events for things like this with logical names.

Set Battle Cam Locations

Set Battle Cam Locations function from Board blueprint.

I attached a camera, Battle Cam, to the blueprint to control the initial and end views. This function sets start and end variables for the Battle Cam then sets the current view. The end variables will get used at the end of battles.

Create Player Slots

Create Player Slots function from Board blueprint.

This is a simple function that spawns the Player's Card Slots and uses the Spawn Player Card in Slot event from the Card Slot blueprint. The Create AI Slots does the exact same thing but uses the AI deck to spawn its cards.

Set All Cards Face Down and Card Slots to Not Empty

Set Card Face Down plus Set Card Slot Not Empty custom events from Board blueprint.

These two events are straight forward. Sets all the Cards face down and all the Card Slots to Not Empty.

The last part of the Event Begin Play initiates a State Machine. I'll go over those in the State Machine section.

Choose a class below to learn about

Card Card Slot Deck Board State Machines
Project Outline Button Widgets Level Database