Sakura Pong is a two-player pong game with rhythm aesthetics made using Stencyl. It is my first game project using Stencyl made back in January 2020.
I used a region to indicate when the score will increase for each player. Scoring system code is used to also kill the ball when it enters that region and recreate a ball with the velocity stated. Below is where I placed my regions.
This draws out the value of the Player 1 Score into the specified coordinates.
I set the player winning condition to if the player 1 score is more or equal to 10 then switch to win scene.
The code above is applied on the win game scene, it checks who has more or equal to 10 score, only then the text "Player 2 Wins!" or "Player 1 Wins!" will be displayed as shown below.
This sets the velocity of the initial pong ball.
The first power up, is the extra ball power up. If the players pressed End or E, and if the extra ball is not in scene yet, only then the extra ball can be created. I only allow two ball in a game scene at a time.
The extra ball will be created on the x and y center of the attached actor with the same velocity as the main ball movement. For this powerup, I allow it to be use every start of a new round.
If a player pressed F, the down and up controls of the opponent will be set to reverse. I only allow each player to use this power up only once. Thus, after the current loop count it is set to false.
Another power up in my game is the freeze power up. If Q was pressed, the opponents movement controls will be set to false. After a delay of 3 seconds, only then their movements will be set back to true. Again, I only allow each player to use the freeze power up once.
Comments