Poo Text
This commit is contained in:
parent
1bff7f2bc4
commit
57c5aaa714
3
game/dist/project-constants.json
vendored
3
game/dist/project-constants.json
vendored
@ -20,6 +20,7 @@
|
|||||||
"player": {
|
"player": {
|
||||||
"max_velocity": 3,
|
"max_velocity": 3,
|
||||||
"acceleration": 2,
|
"acceleration": 2,
|
||||||
"deceleration": 1
|
"deceleration": 1,
|
||||||
|
"start_size": 0.8
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,9 @@ pub struct PlayerConstants {
|
|||||||
|
|
||||||
/// Deceleration, tiles per second per second
|
/// Deceleration, tiles per second per second
|
||||||
pub deceleration: u32,
|
pub deceleration: u32,
|
||||||
|
|
||||||
|
/// Starting size of player in tiles
|
||||||
|
pub start_size: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This structure is filled with the contents of `dist/project-constants.json` at runtime
|
/// This structure is filled with the contents of `dist/project-constants.json` at runtime
|
||||||
|
@ -82,33 +82,43 @@ impl PlayableScene {
|
|||||||
// Clear the screen
|
// Clear the screen
|
||||||
draw.clear_background(Color::WHITE);
|
draw.clear_background(Color::WHITE);
|
||||||
|
|
||||||
{
|
self.draw_world(&mut draw, constants);
|
||||||
// Begin camera mode
|
|
||||||
let mut ctx2d = draw.begin_mode2D(self.camera);
|
|
||||||
|
|
||||||
// Render the map
|
self.draw_ui(&mut draw, constants);
|
||||||
self.world_map.render_map(&mut ctx2d, &self.camera, true);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for i in 0..100 {
|
pub fn draw_world(
|
||||||
for j in 0..100 {
|
&mut self,
|
||||||
draw.draw_rectangle(
|
draw: &mut RaylibDrawHandle,
|
||||||
constants.tile_size as i32 * (i * 2),
|
constants: &ProjectConstants,
|
||||||
constants.tile_size as i32 * (j * 2) * -1,
|
) {
|
||||||
constants.tile_size as i32,
|
// Begin camera mode
|
||||||
constants.tile_size as i32,
|
let mut ctx2d = draw.begin_mode2D(self.camera);
|
||||||
Color::RED
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
draw.draw_rectangle(
|
// Render the map
|
||||||
|
self.world_map.render_map(&mut ctx2d, &self.camera, true);
|
||||||
|
|
||||||
|
ctx2d.draw_rectangle(
|
||||||
self.player.position[0] as i32,
|
self.player.position[0] as i32,
|
||||||
self.player.position[1] as i32 * -1,
|
self.player.position[1] as i32 * -1,
|
||||||
(constants.tile_size as f32 * self.player.size) as i32,
|
(constants.tile_size as f32 * constants.player.start_size * self.player.size) as i32,
|
||||||
(constants.tile_size as f32 * self.player.size) as i32,
|
(constants.tile_size as f32 * constants.player.start_size * self.player.size) as i32,
|
||||||
Color::GREEN
|
Color::GREEN
|
||||||
);
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn draw_ui(
|
||||||
|
&mut self,
|
||||||
|
draw: &mut RaylibDrawHandle,
|
||||||
|
constants: &ProjectConstants,
|
||||||
|
) {
|
||||||
|
draw.draw_fps(0, 0);
|
||||||
|
draw.draw_text(
|
||||||
|
"Poo Text",
|
||||||
|
10, 100, 144,
|
||||||
|
Color::BROWN
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Physics
|
// Physics
|
||||||
|
Reference in New Issue
Block a user