File: file.prg

package info (click to toggle)
gtksourceview4 4.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 15,840 kB
  • sloc: ansic: 49,715; sh: 4,917; xml: 1,302; makefile: 1,010; python: 230; perl: 52; yacc: 45; cobol: 20; objc: 19; sed: 16; fortran: 14; cpp: 8; ml: 3
file content (28 lines) | stat: -rw-r--r-- 494 bytes parent folder | download | duplicates (16)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import "mod_say"
import "mod_rand"
import "mod_screen"
import "mod_video"
import "mod_map"
import "mod_key"

// Bouncing box example
process main()
private
  int vx=5, vy=5;

begin
  set_mode(640, 480, 16, MODE_WINDOW);
  graph = map_new(20, 20, 16);
  map_clear(0, graph, rgb(255, 0, 0));
  x = 320; y = 240;
  while(! key(_esc))
    if(x > 630 || x < 10)
      vx = -vx;
    end;
    if(y > 470 || y < 10)
      vy = -vy;
    end;
    x += vx; y += vy; // Move the box
    frame;
  end;
end;