-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Rusty Roguelike for Macroquad * Add Rusty Roguelike Macroquad to README * Add Rusty Roguelike image Co-authored-by: Saverio Miroddi <[email protected]>
- Loading branch information
1 parent
477306e
commit cb850d1
Showing
35 changed files
with
2,071 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[package] | ||
name = "rusty-dungeon" | ||
version = "0.5.0" | ||
authors = ["Olle Wreede <[email protected]>"] | ||
edition = "2021" | ||
|
||
[dependencies] | ||
macroquad = "0.3.3" | ||
legion = { version = "=0.3.1", default-features = false, features = ["codegen"] } | ||
getrandom = { version = "0.2", features = ["js"] } | ||
bracket-pathfinding = "0.8.4" | ||
nanoserde = "0.1.26" | ||
lazy_static = "1.4.0" | ||
|
||
# Doesn't work with android build | ||
[profile.dev.package.'*'] | ||
opt-level = 3 | ||
|
||
[profile.release] | ||
opt-level = 'z' | ||
lto = true | ||
panic = 'abort' | ||
codegen-units = 1 | ||
|
||
[package.metadata.scripts] | ||
build-web = "bin/build-web" | ||
serve-web = "bin/serve-web" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Rusty Roguelike for Macroquead | ||
|
||
A small roguelike based on the example in the Hands-on Rust book by Herbert | ||
Wolverson, but written in Macroquad. | ||
|
||
Buy the book from Pragmatic Programmer: | ||
|
||
* https://pragprog.com/titles/hwrust/hands-on-rust/ | ||
|
||
## Acknowledgements | ||
|
||
* Herbert Wolverson for the base code | ||
* Item icons by Caz Wolf https://cazwolf.itch.io/ | ||
* Floor tiles made by homyakokryak | ||
* Assorted CC0/public domain images from opengameart.org | ||
* Knight by PolygonDan | ||
* Potions by Admurin: https://admurin.itch.io/ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
( | ||
entities : [ | ||
( | ||
entity_type: Item, | ||
name : "Healing Potion", sprite : 33, levels : [ 0, 1, 2 ], | ||
provides: [ ("Healing", 6) ], | ||
frequency: 2 | ||
), | ||
( | ||
entity_type: Item, | ||
name : "Weak Healing Potion", sprite : 33, levels : [ 0, 1, 2 ], | ||
provides: [ ("Healing", 2) ], | ||
frequency: 2 | ||
), | ||
( | ||
entity_type: Item, | ||
name : "Dungeon Map", sprite : 123, levels : [ 0, 1, 2 ], | ||
provides: [ ("MagicMap", 0) ], | ||
frequency: 1 | ||
), | ||
( | ||
entity_type: Item, | ||
name : "Short Sword", sprite: 115, levels: [ 0, 1, 2 ], | ||
frequency: 1, | ||
base_damage: 1 | ||
), | ||
( | ||
entity_type: Item, | ||
name : "2-handed Sword", sprite: 83, levels: [ 0, 1, 2 ], | ||
frequency: 1, | ||
base_damage: 2 | ||
), | ||
( | ||
entity_type: Item, | ||
name : "Claymore", sprite: 47, levels: [ 2 ], | ||
frequency: 1, | ||
base_damage: 3 | ||
), | ||
( | ||
entity_type: Enemy, | ||
name : "Bat", sprite : 98, levels : [ 0 ], | ||
hp : 1, | ||
frequency: 8, | ||
base_damage: 1 | ||
), | ||
( | ||
entity_type: Enemy, | ||
name : "Kobold", sprite : 103, levels : [ 0, 1 ], | ||
hp : 2, | ||
frequency: 5, | ||
base_damage: 1 | ||
), | ||
( | ||
entity_type: Enemy, | ||
name : "2-headed Ogre", sprite : 111, levels : [ 0, 1, 2 ], | ||
hp : 4, | ||
frequency: 2, | ||
base_damage: 1 | ||
), | ||
( | ||
entity_type: Enemy, | ||
name : "Deep Troll", sprite : 79, levels : [ 1, 2 ], | ||
hp : 6, | ||
frequency: 2, | ||
base_damage: 2 | ||
), | ||
( | ||
entity_type: Enemy, | ||
name : "Lindwyrm", sprite : 69, levels : [ 2 ], | ||
hp : 8, | ||
frequency: 1, | ||
base_damage: 3 | ||
), | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use crate::prelude::*; | ||
|
||
pub struct CameraView { | ||
pub left_x: i32, | ||
pub right_x: i32, | ||
pub top_y: i32, | ||
pub bottom_y: i32, | ||
} | ||
|
||
impl CameraView { | ||
pub fn new(player_position: Point) -> Self { | ||
Self { | ||
left_x: player_position.x - DISPLAY_WIDTH / 2, | ||
right_x: player_position.x + DISPLAY_WIDTH / 2, | ||
top_y: player_position.y - DISPLAY_HEIGHT / 2, | ||
bottom_y: player_position.y + DISPLAY_HEIGHT / 2, | ||
} | ||
} | ||
|
||
pub fn on_player_move(&mut self, player_position: Point) { | ||
self.left_x = player_position.x - DISPLAY_WIDTH / 2; | ||
self.right_x = player_position.x + DISPLAY_WIDTH / 2; | ||
self.top_y = player_position.y - DISPLAY_HEIGHT / 2; | ||
self.bottom_y = player_position.y + DISPLAY_HEIGHT / 2; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
use crate::prelude::*; | ||
use std::collections::HashSet; | ||
|
||
#[derive(Clone, Copy, Debug, PartialEq)] | ||
pub struct Render { | ||
pub color: Color, | ||
pub sprite: Sprite, | ||
} | ||
|
||
#[derive(Clone, Copy, Debug, PartialEq)] | ||
pub struct Player { | ||
pub map_level: u32, | ||
} | ||
|
||
#[derive(Clone, Copy, Debug, PartialEq)] | ||
pub struct Enemy; | ||
|
||
#[derive(Clone, Copy, Debug, PartialEq)] | ||
pub struct MovingRandomly; | ||
|
||
#[derive(Clone, Copy, Debug, PartialEq)] | ||
pub struct WantsToMove { | ||
pub entity: Entity, | ||
pub destination: Point, | ||
} | ||
|
||
#[derive(Clone, Copy, Debug, PartialEq)] | ||
pub struct Health { | ||
pub current: i32, | ||
pub max: i32, | ||
} | ||
|
||
#[derive(Clone, PartialEq)] | ||
pub struct Name(pub String); | ||
|
||
#[derive(Clone, Copy, Debug, PartialEq)] | ||
pub struct WantsToAttack { | ||
pub attacker: Entity, | ||
pub victim: Entity, | ||
} | ||
|
||
#[derive(Clone, Copy, Debug, PartialEq)] | ||
pub struct ChasingPlayer; | ||
|
||
#[derive(Clone, Copy, Debug, PartialEq)] | ||
pub struct Item; | ||
|
||
#[derive(Clone, Copy, Debug, PartialEq)] | ||
pub struct AmuletOfYala; | ||
|
||
#[derive(Clone, Debug, PartialEq)] | ||
pub struct FieldOfView { | ||
pub visible_tiles: HashSet<Point>, | ||
pub radius: i32, | ||
pub is_dirty: bool, | ||
} | ||
|
||
impl FieldOfView { | ||
pub fn new(radius: i32) -> Self { | ||
Self { | ||
visible_tiles: HashSet::new(), | ||
radius, | ||
is_dirty: true, | ||
} | ||
} | ||
|
||
pub fn clone_dirty(&self) -> Self { | ||
Self { | ||
visible_tiles: HashSet::new(), | ||
radius: self.radius, | ||
is_dirty: true, | ||
} | ||
} | ||
} | ||
|
||
#[derive(Clone, Copy, Debug, PartialEq)] | ||
pub struct ProvidesHealing { | ||
pub amount: i32, | ||
} | ||
|
||
#[derive(Clone, Copy, Debug, PartialEq)] | ||
pub struct ProvidesDungeonMap; | ||
|
||
#[derive(Clone, PartialEq)] | ||
pub struct Carried(pub Entity); | ||
|
||
#[derive(Clone, Copy, Debug, PartialEq)] | ||
pub struct ActivateItem { | ||
pub used_by: Entity, | ||
pub item: Entity, | ||
} | ||
|
||
#[derive(Clone, Copy, Debug, PartialEq)] | ||
pub struct Damage(pub i32); | ||
|
||
#[derive(Clone, Copy, Debug, PartialEq)] | ||
pub struct Weapon; |
Oops, something went wrong.