Page 147 - KEC Khaitan C5 Flipbook
P. 147

HANDS-ON PROJECT



                 PROJECT NAME: Build a Car Racing Game
                 Objective:


                    Build a fun car racing game where the player controls a car to avoid obstacles.
                    Use arrow keys to move left and right, dodge enemy cars, and aim for high scores.

                    Add features like restart, randomized obstacles, and increasing difficulty to keep the
                   game exciting.

                 Screens Employed in the Game















                                    Start Screen              Racing Screen            Restart Screen

                 Step-by-Step Instructions

                 Step 1: Setting Up the Road and Player

                    Create the Road Sprite:

                   var road = createSprite(200, 200);

                   road.setAnimation("road");

                   road.scale = 1;
                   o   This creates the road background at the center of the screen.

                   o   Tip: Choose a road background sprite from the animation library.

                   o   Display results on a screen or output box.
                    Create the Player's Car:


                   var player_car = createSprite(200, 350);

                   player_car.setAnimation("car");
                   player_car.scale = 0.6;

                   o   The player's car is positioned near the bottom center of the screen.

                   o   Tip: Choose a unique car sprite to make the game more personalized.




                                                                                    Game Development in Sprite Lab  145
   142   143   144   145   146   147   148   149   150   151   152