
By the end of Task 2 you will have a stoplight, built from four shapes whose numbers put every one of them exactly where it lands.
Task 3 is not shown. The pole and the street sign are yours to work out.
'F' → Fullscreen
Make your own copy of the game template, named 1-7-stoplight. Never edit a template directly.
Everything you draw today goes between BeginDrawing and EndDrawing. Nothing moves, so nothing needs to change between one frame and the next.
DrawText line and make your file match the code below.Color.DarkGray to Color.Black and run again. Change screenHeight to 300 and run again. Then set both back.#:package Raylib-cs@8.0.0
using Raylib_cs;
int screenWidth = 400;int screenHeight = 600;
Raylib.InitWindow(screenWidth, screenHeight, "Stoplight");Raylib.SetTargetFPS(60);
while (!Raylib.WindowShouldClose()){ Raylib.BeginDrawing(); Raylib.ClearBackground(Color.DarkGray); Raylib.EndDrawing();}
Raylib.CloseWindow();#:package Raylib-cs@8.0.0
using Raylib_cs;
int screenWidth = 400;int screenHeight = 600;
Raylib.InitWindow(screenWidth, screenHeight, "Stoplight");Raylib.SetTargetFPS(60);
while (!Raylib.WindowShouldClose()){ Raylib.BeginDrawing(); Raylib.ClearBackground(Color.DarkGray);
Raylib.DrawRectangle(140, 60, 120, 320, Color.Black); Raylib.DrawCircle(200, 120, 40, Color.Red); Raylib.DrawCircle(200, 220, 40, Color.Yellow); Raylib.DrawCircle(200, 320, 40, Color.Green);
Raylib.EndDrawing();}
Raylib.CloseWindow();The housing has to be drawn first. Move it below the three circles and run it again to see why, then put it back.
DrawText. Watch your order — if the name vanishes, you drew the board on top of it.DrawText takes x, y, a size, and a color, and its x and y are its top left corner. Raylib.BeginDrawing(); Raylib.ClearBackground(Color.DarkGray);
Raylib.DrawRectangle(140, 60, 120, 320, Color.Black); Raylib.DrawCircle(200, 120, 40, Color.Red); Raylib.DrawCircle(200, 220, 40, Color.Yellow); Raylib.DrawCircle(200, 320, 40, Color.Green);
// Add a pole and a street sign below the light: // a narrow gray rectangle running down from the housing // a wider sign board below the pole // the street name, drawn on top of the sign
Raylib.EndDrawing();Answer the following questions before submitting your work.
while loop and did not change it. What do you think would happen if you deleted it and left only the drawing lines?Submit three things to the dropbox: