-
Notifications
You must be signed in to change notification settings - Fork 0
/
collisions_2.bas
133 lines (111 loc) · 3.29 KB
/
collisions_2.bas
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
rem Základy Batari BASICu
rem
rem Použito v článcích:
rem
rem Tvorba her pro Atari 2600 v Batari BASICu: úkol pro hardcode programátory
rem https://www.root.cz/clanky/tvorba-her-pro-atari-2600-v-batari-basicu-ukol-pro-hardcode-programatory/
rem
rem Tvorba her pro Atari 2600 v Batari BASICu: ovládání čipu TIA
rem https://www.root.cz/clanky/tvorba-her-pro-atari-2600-v-batari-basicu-ovladani-cipu-tia/
rem
rem Tvorba her pro Atari 2600 v Batari BASICu: standardní kernel a zvuky
rem https://www.root.cz/clanky/tvorba-her-pro-atari-2600-v-batari-basicu-standardni-kernel-a-zvuky/
playfield:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
................................
................................
................................
................................
................................
................................
................................
................................
................................
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
end
player0:
%01000010
%10000001
%01011010
%11111111
%11011011
%01111110
%00111100
%00011000
end
player1:
%10100101
%01011010
%00100100
%11111111
%11011011
%01111110
%00111100
%00011000
end
player0x = 20
player0y = 20
player1x = 140
player1y = 30
missile0x = 80
missile0y = 40
missile0height = 4
missile1x = 80
missile1y = 60
missile1height = 4
ballx = 80
bally = 50
ballheight = 8
rem Posun hrace #1 v horizontalnim smeru
let a = 1
rem Posun hrace #2 v horizontalnim smeru
let b = 1
rem Posun strely 0 v horizontalnim i vertikalnim smeru
let c = 1
let d = 1
rem Posun strely 1 v horizontalnim i vertikalnim smeru
let e = 1
let f = -1
mainloop
rem Sirka strel
NUSIZ0 = $20
NUSIZ1 = $20
rem Sirka mice
CTRLPF = $31
rem Barvy pozadi i hracu
COLUPF = 14
COLUP0 = $1E
COLUP1 = $4E
player0x = player0x + a
if player0x >= 152 then player0x = 152: a =- 1
if player0x <= 0 then player0x = 0: a = 1
player1x = player1x + b
if player1x >= 152 then player1x = 152: b =- 1
if player1x <= 1 then player1x = 1: b = 1
missile0x = missile0x + c
if missile0x >= 152 then missile0x = 152: c =- 1
if missile0x <= 1 then missile0x = 1: c = 1
missile0y = missile0y + d
if missile0y >= 80 then missile0y = 80: d =- 1
if missile0y <= 10 then missile0y = 10: d = 1
missile1x = missile1x + e
if missile1x >= 152 then missile1x = 152: e =- 1
if missile1x <= 1 then missile1x = 1: e = 1
missile1y = missile1y + f
if missile1y >= 80 then missile1y = 80: f =- 1
if missile1y <= 10 then missile1y = 10: f = 1
if joy0up then bally = bally - 1
if joy0down then bally = bally + 1
if joy0left then ballx = ballx - 1
if joy0right then ballx = ballx + 1
if collision(missile0, player0) then COLUPF = $38
if collision(missile0, player1) then COLUPF = $48
if collision(missile1, player0) then COLUPF = $58
if collision(missile1, player1) then COLUPF = $68
if collision(missile0, missile1) then COLUPF = $78
if collision(ball, player0) then COLUP0 = $48
if collision(ball, player1) then COLUP1 = $48
if collision(ball, missile0) then COLUP0 = $48
if collision(ball, missile1) then COLUP1 = $48
drawscreen
goto mainloop