Nano War - Movements and scrolling
3. Movements and scrolling
Making the ship move
We have to define the movement of the player's ship. Click on the "Fighter" object to display its properties in the property explorer. Select the “Movement” tab, and open the “Type” combo box. Choose the movement name “Eight directions”. Then in the Property Explorer, choose a rather fast speed (about 75%), a slow acceleration and deceleration (25%). Click on the "Directions" tab and only select left and right. You can try the movement at any time.
Alien movements
Let's define the movement of the aliens. Click on each one of them in a turn, to display their properties in the Property Explorer. Select the “Movement” tab, and affect to them a “Bouncing Ball” movement. Then enter the following parameters : slow speed (5 or 10%), initial direction facing top, as in the picture. Enter a slightly higher speed for the "Alien" object : it will be hard to destroy. Do the same with the "Spore" object with a speed of 25% for this object.
Frame scrolling
We have finished with the frame editor. Please click on the "Event editor" button in the tool bar. First of all, we are going to create the scrolling. This is done very simply by entering the following event. Once this done, you can start the game and admire the scrolling.
- Always
: Center display at (-1,2) from (fighter)
Moving the ship vertically
Our ship for the moment only moves to the left or to the right. Enter the following event to make it explore the entire content of the screen. Hint : to create a second condition for one event, right click on the first condition and choose "Insert".
- Repeat while "Down Arrow" is pressed
+ Y position of (fighter) < 400
(fighter) : Set Y position to Y( " (fighter)" ) + 8
- Repeat while "Up Arrow" is pressed
+ Y position of (fighter) > 40
(fighter) : Set Y position to Y( " (fighter)" ) - 8
Limiting the movements of the ship
We still need to limit the ship on the left and on the right, so that it does not go out of the playfield. Enter the following event to do so :
- (fighter) leaves the play area
(fighter) : Stop
Spread the word!
You can share this document using the following buttons.