Street Racing Game
Create the opening screen
相信大家在之前的練習中已學會了如何加入圖片、聲音及背景等素材。 由於時間關係,我們直接開啟我們範本。 \\schoolpublic\…..
Create the room and set the background image.
Set the vertical speed to 3, therefore the background will move down slowly at a speed 3.
Create the controller_start to control the object in the room0.
Set the probability to generate a car_down is 1/50
Similarly, set the probability to generate a car_up is 1/100
Left click the mouse to add the controller_start in room0. You can preview the game now!!!
Add an event to start the game by pressing any key
Set the transition style as you want.
Set the background music at the “Game Start” Event Add event other Game Start Play sound!!!
Under the “Game Start” Set the “New score” = 0
New lives = 3
Add some instruction for the user Add Event Draw
Select the Font and alignment
Select the Colour
Add the Text and the position as you want
Similarly, add the second row of text.
SET the Object: car_down
Reset the variable “dead” to “false”
As there are four kind of car, we set the game to generate the car randomly among the four.
Use the “Jump to start” the set a car created in lane 3 Set the vertical speed is 6
Set the car created at lane 3 with a chance 1/2
Preview
Start a block
Similarly, Set the Use the “Jump to start” the set a car created in lane 2 Set the vertical speed is 5
Set the car created at lane 3 with a chance 1/3 Similarly, Set the Use the “Jump to start” the set a car created in lane 2 Set the vertical speed is 5
When the car go outside the room
If the car y position of the car > room_height
Destroy the instance
Overlap
Check object Overlap
car_up x = 44+300 speed = 2 x = 44+240 speed = 1 x = 44+180 Similarly, Set the car_up
Complete the opening room End of Lesson 1
Lesson 2 Create the Room 1
Create the required “Object”
Create Object: controller It is used to control the generation of car_up, car_down, police car, petrol, score and lives.
Set the variable name and value as global.petrol and 1000.
Set the Alarm0 as 300.
Alarm0 is used to generate the petrol in the game. Add Event Alarm Alarm0
Main1 Create Object Gas X 40+random(320) Y -40
Main2 Create Set Alarm Number of Steps : 300+score/100
Add Event Step Score new score 1 (relative)
Then Set the step as below: car_down car_up Police car
When there is no more lives : Show the Highscore table 2. Restart the Game
Draw the score caption : Lives (Cars left) 3. Petrol
Draw the petrol left box
480+max(0,min(100,global.petrol/10))
Create car_racing
Set the variable “dead “ as “false”
Set the vertical speed as 0
What happen after “Crash” Racing car
Similarly for the car_up
Create the Room 1
What happen after “Crash” car_down, car_up and police car
Control the racing car to move Left
global.petrol > 0 && x >32 && not dead
Left: global.petrol > 0 && x >32 && not dead Right: global.petrol > 0 && x < 360 && not dead Up: global.petrol > 0 && not dead Down: global.petrol > 0 && not dead Left: x = -2, y=0 Right: x = 2, y=0 Up: x = 0, y=-3 Down: x = 0, y=3
End of Lesson 2
When the racing car get the petrol
Create petrol
Set the speed of petrol as the background = 3
If the y position of the petrol as the height, destroy the instance.
Go back to the setting of the racing_car.
Create the police car
1. Sound = sirens, loop =true 2. Variable “dead” = false 3. Vertical speed = -1.5 4. X car_racing.x Y room_height 5. Check object ”racing car” 6. Destroy the instance 7. Check object ”racing car” 8. Destroy the instance 9. Check object ”racing car” 10. Destroy the instance
If dead = true 2. Exit 3. If “car_racing.x<x && place_empty(x-8,y)” 4. Jump to left (-2) relatively If “car_racing.x>x && place_empty(x+8,y)” 6. Jump to right (2) relatively
Similar to car_down and racing_car. Vertical speed =3 Similar to car_down and racing_car.
y<0 || y > room_height+20
Completed!!
End of the Game
Additional tasks Add hearts to increase the lives Add coins to increase the score Add gun to shoot the other cars