-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.ras
126 lines (83 loc) · 2.81 KB
/
game.ras
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
program EnchantedForest;
/*
Original game created by Fabrizio Caruso as a 10 liner BASIC program.
https://github.com/Fabrizio-Caruso/CBM-BASIC-10-liners/tree/master/Vic20/EnchantedForest
This version created & expanded by Andy Hewitt - Hewco.uk
-------------------
Dev Note: Zero Page addresses have been defined in project settings
for the Vic 20 build.
_memory - all variables and resources
_constants - game constants & parameters
_lookup - read only look up tables
*/
var
@define DEBUG 1
@donotremove sprRight_A
@donotremove sprRight_B
@donotremove sprLeft_A
@donotremove sprLeft_B
@donotremove sprVert1_A
@donotremove sprVert1_B
@donotremove sprVert2_A
@donotremove sprVert2_B
// -------------------------------------------------------------------------------
@include "_constants.ras" // GAME PARAMETERS and CONSTANTS
@include "_memory.ras" // Include Resources and variables
// -------------------------------------------------------------------------------
@startblock $2000 "GAME"
// -------------------------------------------------------------------------------
// look up data
@include "_lookup.ras" // read only lookup tables
// -------------------------------------------------------------------------------
// source files
@include "music.ras"
@include "vbl.ras"
@include "level.ras"
@include "player.ras"
// -------------------------------------------------------------------------------
// **** MAIN PROGRAM ****
begin
m1 := musCh1;
//m2 := musCh1;
musDelay := 5;
musTime := 0;
Vbl_Init(); // call before set display mode
vbmSetDisplayMode( 0 );
vbmclear( 0 );
vbmClearColor( GREEN );
AUX_COLOR_AND_VOLUME := %00000010;
screen_bg_color := BLACK + SCREEN_BG_BLACK;
Level_Generate();
pd := 0;
Player_SetAnimation();
while (true) offpage do
begin
vbmSetPosition2( px, py );
vbmDrawSprite8E( pa, pb );
@ifdef DEBUG
screen_bg_color := BLACK + SCREEN_BG_BLACK;
@endif
while (ticks = oldticks) do begin end;
oldticks := ticks;
@ifdef DEBUG
screen_bg_color := CYAN + SCREEN_BG_BLACK;
@endif
vbmSetPosition2( px, py );
vbmDrawSprite8E( pa, pb );
if ticks & 1 = 0 then
begin
readjoy1();
// force in keyboard
if getkey() = KEY_I then joy1 := JOY_UP;
if getkey() = KEY_K then joy1 := JOY_DOWN;
if getkey() = KEY_J then joy1 := JOY_LEFT;
if getkey() = KEY_L then joy1 := JOY_RIGHT;
if (joy1 & JOY_UP) then begin py := py - 2; pd:=4+(py&4)>>1; Player_SetAnimation(); end;
if (joy1 & JOY_DOWN) then begin py := py + 2; pd:=4+(py&4)>>1; Player_SetAnimation(); end;
if (joy1 & JOY_LEFT) then begin px := px - 2; pd:=2; Player_SetAnimation(); end;
if (joy1 & JOY_RIGHT) then begin px := px + 2; pd:=0; Player_SetAnimation(); end;
cm := addresstable(colmem, px>>3, py>>4);
cm[0] := white;
end;
end;
end.