-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.pl
More file actions
66 lines (58 loc) · 1.37 KB
/
Copy pathmain.pl
File metadata and controls
66 lines (58 loc) · 1.37 KB
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
/* File MAIN */
/* START THE GAME */
start :- g_read(started, X), X = 1, write('Game has already started'), nl, fail, !.
start :-
g_read(started, X), X = 0, !,
g_assign(started, 1),
set_seed(50), randomize,
init_everything,
print_title,
print_commands,print_legends, write('\n'), map,
asserta(deadzone_timer(7)), !,
main_loop.
/* Main loop of the program */
main_loop :-
print_player_nearby,
repeat,
set_seed(50), randomize,
write('\nDo something > '),
read(Input), nl,
%is_input(Input),
call(Input), nl,
exec(tick), nl, is_turn(Input),
(Input == quit; endGame).
/* Init everything when game started without load */
init_everything :-
initItems,
init_Player,
initDeadzone,
init_enemy(10).
initDeadzone :-
asserta(deadzone_area(0)).
/* Check for command which not make a turn */
/* for save status look map, the player dont make a turn */
is_turn(load) :- !.
is_turn(save) :- !.
is_turn(status) :- !.
is_turn(look) :- !.
is_turn(help) :- !.
is_turn(map) :- !.
is_turn(listing) :- !.
/* make a turn */
is_turn(attack):-
generate_random_move(10).
is_turn(atas) :-
enemy_attack,
generate_random_move(10).
is_turn(kanan) :-
enemy_attack,
generate_random_move(10).
is_turn(kiri) :-
enemy_attack,
generate_random_move(10).
is_turn(bawah) :-
enemy_attack,
generate_random_move(10).
is_turn(_) :-
generate_random_move(10),
enemy_attack.