# Tips knowledge share starter

Hi, so in building my first game there’s a whole lot of simple things I’ve learnt about approaches in my game. These could be useful to other people starting out plus I imagine there’s more you guys have up your sleeves.

I’ll start.

1.) Developing for Universal iOS

use width and height to create a percentage of your screen size so you can place/move/object detect on any devices screen size. E.g

``````scalerX=WIDTH/100
scalerY=HEIGHT/100
``````

So an object’s width like a hero or a bad guy could be

``````scalerX*40
``````

making him 40 percent of the screen size. Same for height just use then

``````scalerY*20
``````

I found it useful to design the game for iPhone 4 size 320x480 and so any objects could be worked out as percentages. A sprite that was 64 pixels wide is a

``````scalerX*20
``````

A height of 96 pixels is a

``````scalerY*20
``````

Positioning the object is just as simple and you can place things off screen left with scalerX*-20 which puts it 64 pixels off the left side of the screen.

2.) Build in test modes

My game had several objects to test that were placed on the stage at random and so appear at different times in the game. But testing them took ages as they wouldn’t appear straight away. So I built a tester mode around the random engine which said -

`````` if mode==0 then
--math generator
if mathO==1 then
obstacle=math.random(1,8)
mathO=0
end
elseif mode==1 then
obstacle=8
end
``````

So I then have a variable called ‘mode’ which I set to ‘0’ to play a full game. But when I want to test only one obstacle I set ‘mode’ manually to ‘1’ and change the number for obstacle in the elseif statement to be the number of my obstacle to test. That way the game only serves up that obstacle over and over again to test making testing more efficient.

It doesn’t have to be for obstacles, but by baking in a test mode for key things you can see how those components work handy for fine tuning sprite collision etc…