Since we're using scratch, the screen resolution is 480x360 pixels, so we'll create our level with double the size of that(960x720) and then we will divide it in four parts.
You can break it in as many parts as you want, but in order to do so you will have to calculate the dimension of each part and work out the level resolution accordingly.
Moving on to coding, we will first use this template:
The code for each of the sprites used for the back ground is similar to this:
Going back 1 layer puts the sprite behind the aim. The x and y position of the sprite puts their centre inn one of the four corners. With each in their respective corners, the full image is complete.
The following code moves around the sniper scope through the level up to a certain position x or y. The variable scrollx is that limit. If we don't use this limitation the player will scroll infinitely until he is out of the level map. Each one of the four codes sets this limit to one of the four corners.
The following code moves around the sniper scope through the level up to a certain position x or y. The variable scrollx is that limit. If we don't use this limitation the player will scroll infinitely until he is out of the level map. Each one of the four codes sets this limit to one of the four corners.
Moving the scope |
Limits of the screen |
Placing the building |
Placing character inside building |
Placing grey background behind character |
No comments :
Post a Comment