Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Hi everyone!

I wanted to share a quick behind-the-scenes look at how the combat mechanics and, specifically, the player scoring system are structured in the current build. The entire logic relies on checking character states at the exact moment a hit connects (On Hit).

1. Hit Detection & Enemy State (On Hit)

When an enemy is hit, the game triggers a Switch statement that checks the $Enemy_State variable (the enemy's current status, which has 4 options: 0 to 3).

If the enemy is in state 0, 1, or 3, the game performs an additional check: If ($Player_State == 1).

If the player is in the correct state (for example, in the middle of a specific attack animation), the main scoring script is triggered: Player_Scores.

Fun fact: In state 2, instead of awarding points, the game currently just plays a blade sound effect (play blade sound)!


2. The Scoring Script (Player_Scores)

Once the Player_Scores script is called, it executes a sequence of key actions:

Updates and displays the current score UI (Display "player scores").

Increases the global player score variable by 1 (Increment $Player_Score by 1).

Calls an external script named Score_Changer (responsible for visual feedback or UI transition logic).

Finally, it fires the most important function: Check_Win_Condition.


3. Checking the Win Condition (Check_Win_Condition)

This function manages the end of the match. It checks whether the total points scored by the attacking side have reached the required threshold to win the fight.