# Need help in optimising a game of pong

Get help using Construct 2

### » Thu May 31, 2012 3:27 pm

Hello,

So after reading a bit of the manual and doing two tutorials I decided to learn through a bit of action. This is how I created a simple game of pong. The game is complete and functional, but I would like to ask a few questions in hopes that some of the veterans might share better ways of doing things, optimization tips or explanations for stuff I haven't understood. With the proper feedback, I am hoping this post will become a good educational ressource both for me and other noobs who have the patience to read it all (it will be long).

So the introduction being done, this is the game:

Pong

All the graphics and letters are hand made in gale:

I made this decision because I didn't like the fonts I could find in the "Text" element and I didn't like the idea of using google web fonts either. Now the way I did it was by making a drawing of a word. I am sure this can be done in easier ways but don't know how.

question nr 1:

When creating your own font, shouldn't it be better to use vector graphics that would scale easier? And if you do use them, how should they be exported so that they are recognized by construct 2 (and how to introduce them in c2)?

The start menu template contains a moving ball that bounces off the walls - I used the same logic for the main game. When I made it I was inspired by this simple platform game tutorial. Now in the beginning I thought I don't need to use an animation frame since my ball object is simple and has no animations. So I gave it the bullet and bound to layout behaviours and let it go free but it started rotating (the square wouldn't stay in a fixed position while flying through the layout, it would be spawned rotated by the "set angle to random(360)" action. I fixed this by adding the invisible animation frame that would start rotated and then pinning the ball onto it.

question nr 2:

Is there a way to spawn an object in a certain position, even if it is supposed to follow a random trajectory?

In the actual gameplay layout, the most dificult part was the score displaying and keeping. I created two variables that would keep the score of player 1 and player 2 and then I created events for each score-case. You may call it the "brute force" method as I have seen in another good tutorial about creating menus.

Now I am sure there must be some other, better, faster or easier way of going through multiple case scenarios than comparing each value like I did:

So I guess I will leave it at that for now, thanks in advance for your time.

Best regards.Specter19812012-05-31 18:00:24
B
7
S
1
G
1
Posts: 8
Reputation: 877