macrooreo.blogg.se

Gamesalad display text
Gamesalad display text




gamesalad display text

Currently there’s no limit on how many times a paddle can serve a ball, meaning they can press the space bar over and over bringing more and more balls into play. I made a new attribute, ‘Active Ball’ to tell if there was a ball in play or not, in order to solve the problem of multiple balls flying around.

gamesalad display text

Next we want to fix the multiple ball problem. This is something very important to remember whilst building games, making sure that the game isn’t using loads of memory to remember things it doesn’t even need to. This rule states that after colliding with wither score zone the ball actor will be destroyed from the scene. So what we need to do is add a ‘Destroy’ rule in the logic of the Ball actor. Currently the ball flies into the score zone and goes off screen, but it’s still there, still active. The more more actors that fill the scene, the more important it is to destroy actors after their done being used. Every active actor in the game will take up memory, which can slow down the game. Now there’s another thing I want to do with the score zones. Now when I play test the game I have both the score boards up in the middle. I then just went into it’s behaviors and changed a few key things, first the position so it wouldn’t overlap with the P1 Score board, and second the text box, changing it to the P2Score integer. To save time I just duplicated the Actor and renamed it P2Score Board. So the score board for player 1 is all finished, now for player 2. I did make a potential confusing mistake where I forgot to rename the second behavior, so they both say ‘set x’… To finish this I add to behaviors setting the x an y of the text. Int the text box I select the integer P1Score, which means the text displayed will be a read out of whatever number the integer is at. I then go into the Actor an add a few behaviors, first the ‘Display Text’ which will write out the score. So I created a new actor called P1Score Board and in the actor settings I set it’s Alpha colour to 0, rendering it transparent when dragged into a scene. But now we want to actually display it in-game. So the score is all set up, with an attribute keeping track of each player. It’s then just a matter of duplicating this and putting it in the right hand score zone, with the integer changed to the player 1 score. Since this is the left zone, and the ball colliding with it will mean player 2 has scored, I can chose the player 2 score integer, and tell it to add 1 to it upon collision. The rule states that if this zone collides with the Ball actor, then it should ‘Change Attribute’. So I went into the left score zone actor and added a rule. Next we want to link it up, so that when the Ball goes through this score zone actor the right player gets a point. I went into the actors’ colour and changed the alpha to zero to make them transparent, and then placed one either end of the scene. I then made two new actors the score zones. To keep score I created two integers, attributes that can equal any number, one for each player. The first thing I add is the scoring system. 4%?,-1.4 #.( 4%8%+#' $-.1+ 4%?,-1.Today we finished up the Pong re-make, adding a scoring system, fixing the ball spawning, and working on the serving function.






Gamesalad display text