-
Notifications
You must be signed in to change notification settings - Fork 6
/
player.c
53 lines (44 loc) · 1.16 KB
/
player.c
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
// --------------------------------------------------------------------------
//
// C Kong
// Copyright (C) 2018 Jeff Panici
// All rights reserved.
//
// This software source file is licensed according to the
// MIT License. Refer to the LICENSE file distributed along
// with this source file to learn more.
//
// --------------------------------------------------------------------------
#include <stdio.h>
#include "video.h"
#include "player.h"
static player_t s_player1 = {
.lives = 3,
.level = 1,
.stage = 1,
.score = 692,
};
static player_t s_player2 = {
.lives = 3,
.level = 1,
.stage = 1,
.score = 0,
};
player_t* player1(void) {
return &s_player1;
}
player_t* player2(void) {
return &s_player2;
}
void player1_header_update(uint32_t ticks) {
video_bg_str(1, 1, 1, true, "%06d", s_player1.score);
for (uint8_t i = 0; i < s_player1.lives; i++) {
bg_control_block_t* block = video_tile(3, (uint8_t) (1 + i));
block->tile = 0xff;
block->palette = 2;
block->flags |= f_bg_changed;
}
video_bg_str(3, 25, 2, true, "L=%02d", s_player1.level);
}
void player2_header_update(uint32_t ticks) {
}