Shooting Multiple Bullets
- Posted by Icy_Viking Feb 07, 2020
- 1106 views
Hello all,
I am having a slight problem. I am trying to shoot multiple bullets, but I can only fire one.
atom Width=1024 atom Height=720 constant TRUE=1 constant FALSE=0 InitWindow(Width,Height,"Shump") SetTargetFPS(60) atom black = bytes_to_int({0,0,0,0}) atom red = bytes_to_int({255,0,0,255}) atom bullet_x = GetScreenWidth() / 2 atom bullet_y = GetScreenHeight() / 2 atom bullet_speed = 0.030 integer bullet_visible = FALSE sequence bullets = {} while not WindowShouldClose() do if IsKeyPressed(KEY_SPACE) and bullet_visible = FALSE then bullet_visible = TRUE end if if (bullet_visible) then bullet_x += bullet_speed end if if (bullet_x >= GetScreenWidth()) then bullet_visible = FALSE end if BeginDrawing() ClearBackground(black) if (bullet_visible = TRUE) then DrawCircleV(bullet_x,bullet_y,20,red) end if EndDrawing() end while CloseWindow()