mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-24 00:31:34 +11:00
use new names in games
This commit is contained in:
parent
d6006c7808
commit
e7caff3776
|
@ -1,4 +1,4 @@
|
||||||
use agb::display::object::{OAMManager, Object};
|
use agb::display::object::{OamManager, Object};
|
||||||
use agb::rng;
|
use agb::rng;
|
||||||
use alloc::vec;
|
use alloc::vec;
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
|
@ -39,7 +39,7 @@ pub struct BattleScreenDisplay<'a> {
|
||||||
const HEALTH_BAR_WIDTH: usize = 48;
|
const HEALTH_BAR_WIDTH: usize = 48;
|
||||||
|
|
||||||
impl<'a> BattleScreenDisplay<'a> {
|
impl<'a> BattleScreenDisplay<'a> {
|
||||||
pub fn new(obj: &'a OAMManager, current_battle_state: &CurrentBattleState) -> Self {
|
pub fn new(obj: &'a OamManager, current_battle_state: &CurrentBattleState) -> Self {
|
||||||
let mut misc_sprites = vec![];
|
let mut misc_sprites = vec![];
|
||||||
let player_x = 12;
|
let player_x = 12;
|
||||||
let player_y = 8;
|
let player_y = 8;
|
||||||
|
@ -189,7 +189,7 @@ impl<'a> BattleScreenDisplay<'a> {
|
||||||
|
|
||||||
pub fn update(
|
pub fn update(
|
||||||
&mut self,
|
&mut self,
|
||||||
obj: &'a OAMManager,
|
obj: &'a OamManager,
|
||||||
current_battle_state: &CurrentBattleState,
|
current_battle_state: &CurrentBattleState,
|
||||||
) -> Vec<Action> {
|
) -> Vec<Action> {
|
||||||
for (i, player_shield) in self.objs.player_shield.iter_mut().enumerate() {
|
for (i, player_shield) in self.objs.player_shield.iter_mut().enumerate() {
|
||||||
|
@ -279,7 +279,7 @@ impl<'a> BattleScreenDisplay<'a> {
|
||||||
actions_to_apply
|
actions_to_apply
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_action(&mut self, action: Action, obj: &'a OAMManager, sfx: &mut Sfx) {
|
pub fn add_action(&mut self, action: Action, obj: &'a OamManager, sfx: &mut Sfx) {
|
||||||
play_sound_for_action_start(&action, sfx);
|
play_sound_for_action_start(&action, sfx);
|
||||||
|
|
||||||
self.animations
|
self.animations
|
||||||
|
@ -309,7 +309,7 @@ impl<'a> EnemyAttackDisplay<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update(&mut self, attack: &Option<EnemyAttackState>, obj: &'a OAMManager) {
|
pub fn update(&mut self, attack: &Option<EnemyAttackState>, obj: &'a OamManager) {
|
||||||
if let Some(attack) = attack {
|
if let Some(attack) = attack {
|
||||||
self.face.show().set_sprite(
|
self.face.show().set_sprite(
|
||||||
obj.get_vram_sprite(ENEMY_ATTACK_SPRITES.sprite_for_attack(attack.attack_type())),
|
obj.get_vram_sprite(ENEMY_ATTACK_SPRITES.sprite_for_attack(attack.attack_type())),
|
||||||
|
@ -350,7 +350,7 @@ enum AnimationUpdateState {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> AnimationStateHolder<'a> {
|
impl<'a> AnimationStateHolder<'a> {
|
||||||
fn for_action(a: Action, obj: &'a OAMManager) -> Self {
|
fn for_action(a: Action, obj: &'a OamManager) -> Self {
|
||||||
let state = match a {
|
let state = match a {
|
||||||
Action::PlayerActivateShield { amount, .. } => {
|
Action::PlayerActivateShield { amount, .. } => {
|
||||||
AnimationState::PlayerActivateShield { amount, frame: 0 }
|
AnimationState::PlayerActivateShield { amount, frame: 0 }
|
||||||
|
@ -383,7 +383,7 @@ impl<'a> AnimationStateHolder<'a> {
|
||||||
fn update(
|
fn update(
|
||||||
&mut self,
|
&mut self,
|
||||||
objs: &mut BattleScreenDisplayObjects<'a>,
|
objs: &mut BattleScreenDisplayObjects<'a>,
|
||||||
obj: &'a OAMManager,
|
obj: &'a OamManager,
|
||||||
current_battle_state: &CurrentBattleState,
|
current_battle_state: &CurrentBattleState,
|
||||||
) -> AnimationUpdateState {
|
) -> AnimationUpdateState {
|
||||||
match &mut self.state {
|
match &mut self.state {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use agb::{
|
use agb::{
|
||||||
display::{
|
display::{
|
||||||
object::{OAMManager, Object},
|
object::{OamManager, Object},
|
||||||
tiled::{RegularMap, TiledMap},
|
tiled::{RegularMap, TiledMap},
|
||||||
HEIGHT, WIDTH,
|
HEIGHT, WIDTH,
|
||||||
},
|
},
|
||||||
|
@ -91,7 +91,7 @@ fn move_net_position_ud(idx: usize, direction: Tri) -> usize {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_dice_display<'a>(gfx: &'a OAMManager, dice: &'_ PlayerDice) -> Vec<Object<'a>> {
|
fn create_dice_display<'a>(gfx: &'a OamManager, dice: &'_ PlayerDice) -> Vec<Object<'a>> {
|
||||||
let mut objects = Vec::new();
|
let mut objects = Vec::new();
|
||||||
for (idx, dice) in dice.dice.iter().enumerate() {
|
for (idx, dice) in dice.dice.iter().enumerate() {
|
||||||
let mut obj = gfx.add_object_static_sprite(FACE_SPRITES.sprite_for_face(dice.faces[1]));
|
let mut obj = gfx.add_object_static_sprite(FACE_SPRITES.sprite_for_face(dice.faces[1]));
|
||||||
|
@ -105,7 +105,7 @@ fn create_dice_display<'a>(gfx: &'a OAMManager, dice: &'_ PlayerDice) -> Vec<Obj
|
||||||
objects
|
objects
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_net<'a>(gfx: &'a OAMManager, die: &'_ Die, modified: &[usize]) -> Vec<Object<'a>> {
|
fn create_net<'a>(gfx: &'a OamManager, die: &'_ Die, modified: &[usize]) -> Vec<Object<'a>> {
|
||||||
let mut objects = Vec::new();
|
let mut objects = Vec::new();
|
||||||
for (idx, &face) in die.faces.iter().enumerate() {
|
for (idx, &face) in die.faces.iter().enumerate() {
|
||||||
let mut obj = gfx.add_object_static_sprite(FACE_SPRITES.sprite_for_face(face));
|
let mut obj = gfx.add_object_static_sprite(FACE_SPRITES.sprite_for_face(face));
|
||||||
|
@ -139,7 +139,7 @@ fn upgrade_position(idx: usize) -> (u32, u32) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_upgrade_objects<'a>(gfx: &'a OAMManager, upgrades: &[Face]) -> Vec<Object<'a>> {
|
fn create_upgrade_objects<'a>(gfx: &'a OamManager, upgrades: &[Face]) -> Vec<Object<'a>> {
|
||||||
let mut objects = Vec::new();
|
let mut objects = Vec::new();
|
||||||
for (idx, &upgrade) in upgrades.iter().enumerate() {
|
for (idx, &upgrade) in upgrades.iter().enumerate() {
|
||||||
let mut obj = gfx.add_object_static_sprite(FACE_SPRITES.sprite_for_face(upgrade));
|
let mut obj = gfx.add_object_static_sprite(FACE_SPRITES.sprite_for_face(upgrade));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use agb::{
|
use agb::{
|
||||||
display::object::{OAMManager, Object, Sprite, Tag},
|
display::object::{OamManager, Object, Sprite, Tag},
|
||||||
fixnum::Vector2D,
|
fixnum::Vector2D,
|
||||||
};
|
};
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
|
@ -141,7 +141,7 @@ pub struct HealthBar<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HealthBar<'a> {
|
impl<'a> HealthBar<'a> {
|
||||||
pub fn new(pos: Vector2D<i32>, max: usize, obj: &'a OAMManager) -> Self {
|
pub fn new(pos: Vector2D<i32>, max: usize, obj: &'a OamManager) -> Self {
|
||||||
assert_eq!(max % 8, 0);
|
assert_eq!(max % 8, 0);
|
||||||
|
|
||||||
let sprites = (0..(max / 8))
|
let sprites = (0..(max / 8))
|
||||||
|
@ -157,7 +157,7 @@ impl<'a> HealthBar<'a> {
|
||||||
Self { max, sprites }
|
Self { max, sprites }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_value(&mut self, new_value: usize, obj: &'a OAMManager) {
|
pub fn set_value(&mut self, new_value: usize, obj: &'a OamManager) {
|
||||||
assert!(new_value <= self.max);
|
assert!(new_value <= self.max);
|
||||||
|
|
||||||
for (i, sprite) in self.sprites.iter_mut().enumerate() {
|
for (i, sprite) in self.sprites.iter_mut().enumerate() {
|
||||||
|
@ -195,7 +195,7 @@ pub struct FractionDisplay<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> FractionDisplay<'a> {
|
impl<'a> FractionDisplay<'a> {
|
||||||
pub fn new(pos: Vector2D<i32>, digits: usize, obj: &'a OAMManager) -> Self {
|
pub fn new(pos: Vector2D<i32>, digits: usize, obj: &'a OamManager) -> Self {
|
||||||
let mut sprites = Vec::with_capacity(digits * 2 + 1);
|
let mut sprites = Vec::with_capacity(digits * 2 + 1);
|
||||||
|
|
||||||
for i in 0..digits {
|
for i in 0..digits {
|
||||||
|
@ -222,7 +222,7 @@ impl<'a> FractionDisplay<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_value(&mut self, current: usize, max: usize, obj: &'a OAMManager) {
|
pub fn set_value(&mut self, current: usize, max: usize, obj: &'a OamManager) {
|
||||||
if self.current_current == current && self.current_max == max {
|
if self.current_current == current && self.current_max == max {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ impl<'a> NumberDisplay<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_value(&mut self, new_value: Option<u32>, obj: &'a OAMManager) {
|
pub fn set_value(&mut self, new_value: Option<u32>, obj: &'a OamManager) {
|
||||||
if self.value == new_value {
|
if self.value == new_value {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#![cfg_attr(test, reexport_test_harness_main = "test_main")]
|
#![cfg_attr(test, reexport_test_harness_main = "test_main")]
|
||||||
#![cfg_attr(test, test_runner(agb::test_runner::test_runner))]
|
#![cfg_attr(test, test_runner(agb::test_runner::test_runner))]
|
||||||
|
|
||||||
use agb::display::object::OAMManager;
|
use agb::display::object::OamManager;
|
||||||
use agb::display::tiled::{TileFormat, TiledMap, VRamManager};
|
use agb::display::tiled::{TileFormat, TiledMap, VRamManager};
|
||||||
use agb::display::Priority;
|
use agb::display::Priority;
|
||||||
use agb::interrupt::VBlank;
|
use agb::interrupt::VBlank;
|
||||||
|
@ -90,7 +90,7 @@ pub struct PlayerDice {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Agb<'a> {
|
struct Agb<'a> {
|
||||||
obj: OAMManager<'a>,
|
obj: OamManager<'a>,
|
||||||
vblank: VBlank,
|
vblank: VBlank,
|
||||||
star_background: StarBackground<'a>,
|
star_background: StarBackground<'a>,
|
||||||
vram: VRamManager,
|
vram: VRamManager,
|
||||||
|
|
|
@ -2,7 +2,7 @@ use crate::TAG_MAP;
|
||||||
|
|
||||||
use super::{sfx::SfxPlayer, Entity, FixedNumberType, HatState, Level};
|
use super::{sfx::SfxPlayer, Entity, FixedNumberType, HatState, Level};
|
||||||
use agb::{
|
use agb::{
|
||||||
display::object::{OAMManager, Tag},
|
display::object::{OamManager, Tag},
|
||||||
fixnum::Vector2D,
|
fixnum::Vector2D,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -35,11 +35,11 @@ pub enum EnemyUpdateState {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Enemy<'a> {
|
impl<'a> Enemy<'a> {
|
||||||
pub fn new_slime(object: &'a OAMManager, start_pos: Vector2D<FixedNumberType>) -> Self {
|
pub fn new_slime(object: &'a OamManager, start_pos: Vector2D<FixedNumberType>) -> Self {
|
||||||
Enemy::Slime(Slime::new(object, start_pos + (0, 1).into()))
|
Enemy::Slime(Slime::new(object, start_pos + (0, 1).into()))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_snail(object: &'a OAMManager, start_pos: Vector2D<FixedNumberType>) -> Self {
|
pub fn new_snail(object: &'a OamManager, start_pos: Vector2D<FixedNumberType>) -> Self {
|
||||||
Enemy::Snail(Snail::new(object, start_pos))
|
Enemy::Snail(Snail::new(object, start_pos))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ impl<'a> Enemy<'a> {
|
||||||
|
|
||||||
pub fn update(
|
pub fn update(
|
||||||
&mut self,
|
&mut self,
|
||||||
controller: &'a OAMManager,
|
controller: &'a OamManager,
|
||||||
level: &Level,
|
level: &Level,
|
||||||
player_pos: Vector2D<FixedNumberType>,
|
player_pos: Vector2D<FixedNumberType>,
|
||||||
hat_state: HatState,
|
hat_state: HatState,
|
||||||
|
@ -94,7 +94,7 @@ struct EnemyInfo<'a> {
|
||||||
|
|
||||||
impl<'a> EnemyInfo<'a> {
|
impl<'a> EnemyInfo<'a> {
|
||||||
fn new(
|
fn new(
|
||||||
object: &'a OAMManager,
|
object: &'a OamManager,
|
||||||
start_pos: Vector2D<FixedNumberType>,
|
start_pos: Vector2D<FixedNumberType>,
|
||||||
collision: Vector2D<u16>,
|
collision: Vector2D<u16>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
@ -135,7 +135,7 @@ pub struct Slime<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Slime<'a> {
|
impl<'a> Slime<'a> {
|
||||||
fn new(object: &'a OAMManager, start_pos: Vector2D<FixedNumberType>) -> Self {
|
fn new(object: &'a OamManager, start_pos: Vector2D<FixedNumberType>) -> Self {
|
||||||
let slime = Slime {
|
let slime = Slime {
|
||||||
enemy_info: EnemyInfo::new(object, start_pos, (14u16, 14u16).into()),
|
enemy_info: EnemyInfo::new(object, start_pos, (14u16, 14u16).into()),
|
||||||
state: SlimeState::Idle,
|
state: SlimeState::Idle,
|
||||||
|
@ -146,7 +146,7 @@ impl<'a> Slime<'a> {
|
||||||
|
|
||||||
fn update(
|
fn update(
|
||||||
&mut self,
|
&mut self,
|
||||||
controller: &'a OAMManager,
|
controller: &'a OamManager,
|
||||||
level: &Level,
|
level: &Level,
|
||||||
player_pos: Vector2D<FixedNumberType>,
|
player_pos: Vector2D<FixedNumberType>,
|
||||||
hat_state: HatState,
|
hat_state: HatState,
|
||||||
|
@ -257,7 +257,7 @@ pub struct Snail<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Snail<'a> {
|
impl<'a> Snail<'a> {
|
||||||
fn new(object: &'a OAMManager, start_pos: Vector2D<FixedNumberType>) -> Self {
|
fn new(object: &'a OamManager, start_pos: Vector2D<FixedNumberType>) -> Self {
|
||||||
let snail = Snail {
|
let snail = Snail {
|
||||||
enemy_info: EnemyInfo::new(object, start_pos, (16u16, 16u16).into()),
|
enemy_info: EnemyInfo::new(object, start_pos, (16u16, 16u16).into()),
|
||||||
state: SnailState::Idle(0),
|
state: SnailState::Idle(0),
|
||||||
|
@ -272,7 +272,7 @@ impl<'a> Snail<'a> {
|
||||||
|
|
||||||
fn update(
|
fn update(
|
||||||
&mut self,
|
&mut self,
|
||||||
controller: &'a OAMManager,
|
controller: &'a OamManager,
|
||||||
level: &Level,
|
level: &Level,
|
||||||
player_pos: Vector2D<FixedNumberType>,
|
player_pos: Vector2D<FixedNumberType>,
|
||||||
hat_state: HatState,
|
hat_state: HatState,
|
||||||
|
|
|
@ -8,7 +8,7 @@ extern crate alloc;
|
||||||
|
|
||||||
use agb::{
|
use agb::{
|
||||||
display::{
|
display::{
|
||||||
object::{Graphics, OAMManager, Object, Tag, TagMap},
|
object::{Graphics, OamManager, Object, Tag, TagMap},
|
||||||
tiled::{
|
tiled::{
|
||||||
InfiniteScrolledMap, PartialUpdateStatus, RegularBackgroundSize, TileFormat, TileSet,
|
InfiniteScrolledMap, PartialUpdateStatus, RegularBackgroundSize, TileFormat, TileSet,
|
||||||
TileSetting, TiledMap, VRamManager,
|
TileSetting, TiledMap, VRamManager,
|
||||||
|
@ -124,7 +124,7 @@ pub struct Entity<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Entity<'a> {
|
impl<'a> Entity<'a> {
|
||||||
pub fn new(object: &'a OAMManager, collision_mask: Vector2D<u16>) -> Self {
|
pub fn new(object: &'a OamManager, collision_mask: Vector2D<u16>) -> Self {
|
||||||
let mut dummy_object = object.add_object_static_sprite(WALKING.sprite(0));
|
let mut dummy_object = object.add_object_static_sprite(WALKING.sprite(0));
|
||||||
dummy_object.set_priority(Priority::P1);
|
dummy_object.set_priority(Priority::P1);
|
||||||
Entity {
|
Entity {
|
||||||
|
@ -347,7 +347,7 @@ fn ping_pong(i: i32, n: i32) -> i32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Player<'a> {
|
impl<'a> Player<'a> {
|
||||||
fn new(controller: &'a OAMManager, start_position: Vector2D<FixedNumberType>) -> Self {
|
fn new(controller: &'a OamManager, start_position: Vector2D<FixedNumberType>) -> Self {
|
||||||
let mut wizard = Entity::new(controller, (6_u16, 14_u16).into());
|
let mut wizard = Entity::new(controller, (6_u16, 14_u16).into());
|
||||||
let mut hat = Entity::new(controller, (6_u16, 6_u16).into());
|
let mut hat = Entity::new(controller, (6_u16, 6_u16).into());
|
||||||
|
|
||||||
|
@ -381,7 +381,7 @@ impl<'a> Player<'a> {
|
||||||
fn update_frame(
|
fn update_frame(
|
||||||
&mut self,
|
&mut self,
|
||||||
input: &ButtonController,
|
input: &ButtonController,
|
||||||
controller: &'a OAMManager,
|
controller: &'a OamManager,
|
||||||
timer: i32,
|
timer: i32,
|
||||||
level: &Level,
|
level: &Level,
|
||||||
enemies: &[enemies::Enemy],
|
enemies: &[enemies::Enemy],
|
||||||
|
@ -615,7 +615,7 @@ enum UpdateState {
|
||||||
impl<'a, 'b> PlayingLevel<'a, 'b> {
|
impl<'a, 'b> PlayingLevel<'a, 'b> {
|
||||||
fn open_level(
|
fn open_level(
|
||||||
level: &'a Level,
|
level: &'a Level,
|
||||||
object_control: &'a OAMManager,
|
object_control: &'a OamManager,
|
||||||
background: &'a mut InfiniteScrolledMap<'b>,
|
background: &'a mut InfiniteScrolledMap<'b>,
|
||||||
foreground: &'a mut InfiniteScrolledMap<'b>,
|
foreground: &'a mut InfiniteScrolledMap<'b>,
|
||||||
input: ButtonController,
|
input: ButtonController,
|
||||||
|
@ -676,7 +676,7 @@ impl<'a, 'b> PlayingLevel<'a, 'b> {
|
||||||
self.player.wizard.sprite.set_priority(Priority::P0);
|
self.player.wizard.sprite.set_priority(Priority::P0);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dead_update(&mut self, controller: &'a OAMManager) -> bool {
|
fn dead_update(&mut self, controller: &'a OamManager) -> bool {
|
||||||
self.timer += 1;
|
self.timer += 1;
|
||||||
|
|
||||||
let frame = PLAYER_DEATH.animation_sprite(self.timer as usize / 8);
|
let frame = PLAYER_DEATH.animation_sprite(self.timer as usize / 8);
|
||||||
|
@ -695,7 +695,7 @@ impl<'a, 'b> PlayingLevel<'a, 'b> {
|
||||||
&mut self,
|
&mut self,
|
||||||
sfx_player: &mut SfxPlayer,
|
sfx_player: &mut SfxPlayer,
|
||||||
vram: &mut VRamManager,
|
vram: &mut VRamManager,
|
||||||
controller: &'a OAMManager,
|
controller: &'a OamManager,
|
||||||
) -> UpdateState {
|
) -> UpdateState {
|
||||||
self.timer += 1;
|
self.timer += 1;
|
||||||
self.input.update();
|
self.input.update();
|
||||||
|
|
|
@ -14,7 +14,7 @@ use alloc::{boxed::Box, vec::Vec};
|
||||||
|
|
||||||
use agb::{
|
use agb::{
|
||||||
display::{
|
display::{
|
||||||
object::{Graphics, OAMManager, Object, Sprite, Tag, TagMap},
|
object::{Graphics, OamManager, Object, Sprite, Tag, TagMap},
|
||||||
tiled::{
|
tiled::{
|
||||||
InfiniteScrolledMap, RegularBackgroundSize, TileFormat, TileSet, TileSetting,
|
InfiniteScrolledMap, RegularBackgroundSize, TileFormat, TileSet, TileSetting,
|
||||||
VRamManager,
|
VRamManager,
|
||||||
|
@ -164,7 +164,7 @@ struct Entity<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Entity<'a> {
|
impl<'a> Entity<'a> {
|
||||||
fn new(object_controller: &'a OAMManager, collision_mask: Rect<u16>) -> Self {
|
fn new(object_controller: &'a OamManager, collision_mask: Rect<u16>) -> Self {
|
||||||
let mut sprite = object_controller.add_object_static_sprite(LONG_SWORD_IDLE.sprite(0));
|
let mut sprite = object_controller.add_object_static_sprite(LONG_SWORD_IDLE.sprite(0));
|
||||||
sprite.set_priority(Priority::P1);
|
sprite.set_priority(Priority::P1);
|
||||||
Entity {
|
Entity {
|
||||||
|
@ -532,7 +532,7 @@ struct Player<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Player<'a> {
|
impl<'a> Player<'a> {
|
||||||
fn new(object_controller: &'a OAMManager<'a>) -> Player {
|
fn new(object_controller: &'a OamManager<'a>) -> Player {
|
||||||
let mut entity = Entity::new(
|
let mut entity = Entity::new(
|
||||||
object_controller,
|
object_controller,
|
||||||
Rect::new((0_u16, 0_u16).into(), (4_u16, 12_u16).into()),
|
Rect::new((0_u16, 0_u16).into(), (4_u16, 12_u16).into()),
|
||||||
|
@ -558,7 +558,7 @@ impl<'a> Player<'a> {
|
||||||
|
|
||||||
fn update(
|
fn update(
|
||||||
&mut self,
|
&mut self,
|
||||||
controller: &'a OAMManager,
|
controller: &'a OamManager,
|
||||||
buttons: &ButtonController,
|
buttons: &ButtonController,
|
||||||
level: &Level,
|
level: &Level,
|
||||||
sfx: &mut sfx::Sfx,
|
sfx: &mut sfx::Sfx,
|
||||||
|
@ -814,7 +814,7 @@ impl BatData {
|
||||||
|
|
||||||
fn update<'a>(
|
fn update<'a>(
|
||||||
&mut self,
|
&mut self,
|
||||||
controller: &'a OAMManager,
|
controller: &'a OamManager,
|
||||||
entity: &mut Entity<'a>,
|
entity: &mut Entity<'a>,
|
||||||
player: &Player,
|
player: &Player,
|
||||||
level: &Level,
|
level: &Level,
|
||||||
|
@ -947,7 +947,7 @@ impl SlimeData {
|
||||||
|
|
||||||
fn update<'a>(
|
fn update<'a>(
|
||||||
&mut self,
|
&mut self,
|
||||||
controller: &'a OAMManager,
|
controller: &'a OamManager,
|
||||||
entity: &mut Entity<'a>,
|
entity: &mut Entity<'a>,
|
||||||
player: &Player,
|
player: &Player,
|
||||||
level: &Level,
|
level: &Level,
|
||||||
|
@ -1076,7 +1076,7 @@ impl MiniFlameData {
|
||||||
|
|
||||||
fn update<'a>(
|
fn update<'a>(
|
||||||
&mut self,
|
&mut self,
|
||||||
controller: &'a OAMManager,
|
controller: &'a OamManager,
|
||||||
entity: &mut Entity<'a>,
|
entity: &mut Entity<'a>,
|
||||||
player: &Player,
|
player: &Player,
|
||||||
_level: &Level,
|
_level: &Level,
|
||||||
|
@ -1205,7 +1205,7 @@ impl EmuData {
|
||||||
|
|
||||||
fn update<'a>(
|
fn update<'a>(
|
||||||
&mut self,
|
&mut self,
|
||||||
controller: &'a OAMManager,
|
controller: &'a OamManager,
|
||||||
entity: &mut Entity<'a>,
|
entity: &mut Entity<'a>,
|
||||||
player: &Player,
|
player: &Player,
|
||||||
level: &Level,
|
level: &Level,
|
||||||
|
@ -1378,7 +1378,7 @@ impl EnemyData {
|
||||||
|
|
||||||
fn update<'a>(
|
fn update<'a>(
|
||||||
&mut self,
|
&mut self,
|
||||||
controller: &'a OAMManager,
|
controller: &'a OamManager,
|
||||||
entity: &mut Entity<'a>,
|
entity: &mut Entity<'a>,
|
||||||
player: &Player,
|
player: &Player,
|
||||||
level: &Level,
|
level: &Level,
|
||||||
|
@ -1399,7 +1399,7 @@ struct Enemy<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Enemy<'a> {
|
impl<'a> Enemy<'a> {
|
||||||
fn new(object_controller: &'a OAMManager, enemy_data: EnemyData) -> Self {
|
fn new(object_controller: &'a OamManager, enemy_data: EnemyData) -> Self {
|
||||||
let mut entity = Entity::new(object_controller, enemy_data.collision_mask());
|
let mut entity = Entity::new(object_controller, enemy_data.collision_mask());
|
||||||
|
|
||||||
let sprite = enemy_data.sprite();
|
let sprite = enemy_data.sprite();
|
||||||
|
@ -1413,7 +1413,7 @@ impl<'a> Enemy<'a> {
|
||||||
|
|
||||||
fn update(
|
fn update(
|
||||||
&mut self,
|
&mut self,
|
||||||
controller: &'a OAMManager,
|
controller: &'a OamManager,
|
||||||
player: &Player,
|
player: &Player,
|
||||||
level: &Level,
|
level: &Level,
|
||||||
sfx: &mut sfx::Sfx,
|
sfx: &mut sfx::Sfx,
|
||||||
|
@ -1444,7 +1444,7 @@ impl ParticleData {
|
||||||
|
|
||||||
fn update<'a>(
|
fn update<'a>(
|
||||||
&mut self,
|
&mut self,
|
||||||
controller: &'a OAMManager,
|
controller: &'a OamManager,
|
||||||
entity: &mut Entity<'a>,
|
entity: &mut Entity<'a>,
|
||||||
player: &Player,
|
player: &Player,
|
||||||
_level: &Level,
|
_level: &Level,
|
||||||
|
@ -1532,7 +1532,7 @@ struct Particle<'a> {
|
||||||
|
|
||||||
impl<'a> Particle<'a> {
|
impl<'a> Particle<'a> {
|
||||||
fn new(
|
fn new(
|
||||||
object_controller: &'a OAMManager,
|
object_controller: &'a OamManager,
|
||||||
particle_data: ParticleData,
|
particle_data: ParticleData,
|
||||||
position: Vector2D<Number>,
|
position: Vector2D<Number>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
@ -1551,7 +1551,7 @@ impl<'a> Particle<'a> {
|
||||||
|
|
||||||
fn update(
|
fn update(
|
||||||
&mut self,
|
&mut self,
|
||||||
controller: &'a OAMManager,
|
controller: &'a OamManager,
|
||||||
player: &Player,
|
player: &Player,
|
||||||
level: &Level,
|
level: &Level,
|
||||||
) -> UpdateInstruction {
|
) -> UpdateInstruction {
|
||||||
|
@ -1578,7 +1578,7 @@ impl<'a> BossState<'a> {
|
||||||
fn update(
|
fn update(
|
||||||
&mut self,
|
&mut self,
|
||||||
enemies: &mut Arena<Enemy<'a>>,
|
enemies: &mut Arena<Enemy<'a>>,
|
||||||
object_controller: &'a OAMManager,
|
object_controller: &'a OamManager,
|
||||||
player: &Player,
|
player: &Player,
|
||||||
sfx: &mut sfx::Sfx,
|
sfx: &mut sfx::Sfx,
|
||||||
) -> BossInstruction {
|
) -> BossInstruction {
|
||||||
|
@ -1613,7 +1613,7 @@ struct FollowingBoss<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> FollowingBoss<'a> {
|
impl<'a> FollowingBoss<'a> {
|
||||||
fn new(object_controller: &'a OAMManager, position: Vector2D<Number>) -> Self {
|
fn new(object_controller: &'a OamManager, position: Vector2D<Number>) -> Self {
|
||||||
let mut entity = Entity::new(
|
let mut entity = Entity::new(
|
||||||
object_controller,
|
object_controller,
|
||||||
Rect::new((0_u16, 0_u16).into(), (0_u16, 0_u16).into()),
|
Rect::new((0_u16, 0_u16).into(), (0_u16, 0_u16).into()),
|
||||||
|
@ -1628,7 +1628,7 @@ impl<'a> FollowingBoss<'a> {
|
||||||
gone: false,
|
gone: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn update(&mut self, controller: &'a OAMManager, player: &Player) {
|
fn update(&mut self, controller: &'a OamManager, player: &Player) {
|
||||||
let difference = player.entity.position - self.entity.position;
|
let difference = player.entity.position - self.entity.position;
|
||||||
self.timer += 1;
|
self.timer += 1;
|
||||||
|
|
||||||
|
@ -1697,7 +1697,7 @@ enum BossInstruction {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Boss<'a> {
|
impl<'a> Boss<'a> {
|
||||||
fn new(object_controller: &'a OAMManager, screen_coords: Vector2D<Number>) -> Self {
|
fn new(object_controller: &'a OamManager, screen_coords: Vector2D<Number>) -> Self {
|
||||||
let mut entity = Entity::new(
|
let mut entity = Entity::new(
|
||||||
object_controller,
|
object_controller,
|
||||||
Rect::new((0_u16, 0_u16).into(), (28_u16, 28_u16).into()),
|
Rect::new((0_u16, 0_u16).into(), (28_u16, 28_u16).into()),
|
||||||
|
@ -1716,7 +1716,7 @@ impl<'a> Boss<'a> {
|
||||||
fn update(
|
fn update(
|
||||||
&mut self,
|
&mut self,
|
||||||
enemies: &mut Arena<Enemy<'a>>,
|
enemies: &mut Arena<Enemy<'a>>,
|
||||||
object_controller: &'a OAMManager,
|
object_controller: &'a OamManager,
|
||||||
player: &Player,
|
player: &Player,
|
||||||
sfx: &mut sfx::Sfx,
|
sfx: &mut sfx::Sfx,
|
||||||
) -> BossInstruction {
|
) -> BossInstruction {
|
||||||
|
@ -1820,7 +1820,7 @@ impl<'a> Boss<'a> {
|
||||||
self.entity
|
self.entity
|
||||||
.commit_with_size(offset + shake, (32, 32).into());
|
.commit_with_size(offset + shake, (32, 32).into());
|
||||||
}
|
}
|
||||||
fn explode(&self, enemies: &mut Arena<Enemy<'a>>, object_controller: &'a OAMManager) {
|
fn explode(&self, enemies: &mut Arena<Enemy<'a>>, object_controller: &'a OamManager) {
|
||||||
for _ in 0..(6 - self.health) {
|
for _ in 0..(6 - self.health) {
|
||||||
let x_offset: Number = Number::from_raw(rng::gen()).rem_euclid(2.into()) - 1;
|
let x_offset: Number = Number::from_raw(rng::gen()).rem_euclid(2.into()) - 1;
|
||||||
let y_offset: Number = Number::from_raw(rng::gen()).rem_euclid(2.into()) - 1;
|
let y_offset: Number = Number::from_raw(rng::gen()).rem_euclid(2.into()) - 1;
|
||||||
|
@ -1894,7 +1894,7 @@ impl<'a> Game<'a> {
|
||||||
|
|
||||||
fn advance_frame(
|
fn advance_frame(
|
||||||
&mut self,
|
&mut self,
|
||||||
object_controller: &'a OAMManager,
|
object_controller: &'a OamManager,
|
||||||
vram: &mut VRamManager,
|
vram: &mut VRamManager,
|
||||||
sfx: &mut sfx::Sfx,
|
sfx: &mut sfx::Sfx,
|
||||||
) -> GameStatus {
|
) -> GameStatus {
|
||||||
|
@ -2108,7 +2108,7 @@ impl<'a> Game<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_enemies(&mut self, object_controller: &'a OAMManager) {
|
fn load_enemies(&mut self, object_controller: &'a OamManager) {
|
||||||
if self.slime_load < self.level.slime_spawns.len() {
|
if self.slime_load < self.level.slime_spawns.len() {
|
||||||
for (idx, slime_spawn) in self
|
for (idx, slime_spawn) in self
|
||||||
.level
|
.level
|
||||||
|
@ -2178,7 +2178,7 @@ impl<'a> Game<'a> {
|
||||||
vram.set_background_palettes(&modified_palettes);
|
vram.set_background_palettes(&modified_palettes);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new(object: &'a OAMManager, level: Level<'a>, start_at_boss: bool) -> Self {
|
fn new(object: &'a OamManager<'a>, level: Level<'a>, start_at_boss: bool) -> Self {
|
||||||
let mut player = Player::new(object);
|
let mut player = Player::new(object);
|
||||||
let mut offset = (8, 8).into();
|
let mut offset = (8, 8).into();
|
||||||
if start_at_boss {
|
if start_at_boss {
|
||||||
|
|
Loading…
Reference in a new issue