Advertisement
LordJakub

Untitled

Feb 5th, 2024
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.76 KB | None | 0 0
  1. import "graphics"
  2. func main(){
  3.     int init = graphics.Init()
  4.     graphics.CreateWindow("Voca game", 800, 600)
  5.    int x = 10
  6.    int y = 10
  7.    
  8.     while (graphics.IsRunning()) {
  9.         graphics.SetColor(255, 255, 255, 255)
  10.         graphics.Clear()
  11.         graphics.SetColor(255, 0, 0, 255)
  12.         graphics.CreatePicture("player.png",x, y, 64, 64)
  13.      
  14.         if (graphics.KeyPressed("W")) {
  15.             y = y-2
  16.         }
  17.          if (graphics.KeyPressed("S")) {
  18.             y = y+2
  19.         }
  20.          if (graphics.KeyPressed("D")) {
  21.             x = x+2
  22.         }
  23.          if (graphics.KeyPressed("A")) {
  24.             x = x-2
  25.         }
  26.         graphics.Update()
  27.         delay(1000/60)
  28.    
  29.     }
  30.     print("Closing app")
  31.    graphics.Close()
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement