update purple night

This commit is contained in:
Corwin 2022-03-12 19:05:20 +00:00
parent 44c7a93fa3
commit 859e7dd4b4

View file

@ -162,10 +162,8 @@ struct Entity<'a> {
impl<'a> Entity<'a> {
fn new(object_controller: &'a ObjectController, collision_mask: Rect<u16>) -> Self {
let s = object_controller
.get_sprite(LONGSWORD_IDLE.get_sprite(0))
.unwrap();
let mut sprite = object_controller.get_object(s).unwrap();
let s = object_controller.get_sprite(LONGSWORD_IDLE.get_sprite(0));
let mut sprite = object_controller.get_object(s);
sprite.set_priority(Priority::P1);
Entity {
sprite,
@ -539,9 +537,7 @@ impl<'a> Player<'a> {
object_controller,
Rect::new((0_u16, 0_u16).into(), (4_u16, 12_u16).into()),
);
let s = object_controller
.get_sprite(LONGSWORD_IDLE.get_sprite(0))
.unwrap();
let s = object_controller.get_sprite(LONGSWORD_IDLE.get_sprite(0));
entity.sprite.set_sprite(s);
entity.sprite.show();
entity.position = (144, 0).into();
@ -596,13 +592,11 @@ impl<'a> Player<'a> {
self.entity.velocity.x += self.sword.ground_walk_force() * x as i32;
if self.entity.velocity.x.abs() > Number::new(1) / 10 {
let sprite = controller
.get_sprite(self.sword.walk_animation(self.sprite_offset))
.unwrap();
.get_sprite(self.sword.walk_animation(self.sprite_offset));
self.entity.sprite.set_sprite(sprite);
} else {
let sprite = controller
.get_sprite(self.sword.idle_animation(self.sprite_offset))
.unwrap();
.get_sprite(self.sword.idle_animation(self.sprite_offset));
self.entity.sprite.set_sprite(sprite);
}
@ -622,9 +616,8 @@ impl<'a> Player<'a> {
let frame = self.sword.attack_frame(*a);
self.fudge_factor.x = self.sword.fudge(frame) * self.facing as i32;
let tag = self.sword.attack_tag();
let sprite = controller
.get_sprite(tag.get_animation_sprite(frame as usize))
.unwrap();
let sprite =
controller.get_sprite(tag.get_animation_sprite(frame as usize));
self.entity.sprite.set_sprite(sprite);
hurtbox = self.sword.ground_attack_hurtbox(frame);
@ -638,9 +631,8 @@ impl<'a> Player<'a> {
let frame = self.sword.hold_frame();
self.fudge_factor.x = self.sword.fudge(frame) * self.facing as i32;
let tag = self.sword.attack_tag();
let sprite = controller
.get_sprite(tag.get_animation_sprite(frame as usize))
.unwrap();
let sprite =
controller.get_sprite(tag.get_animation_sprite(frame as usize));
self.entity.sprite.set_sprite(sprite);
if *a == 0 {
self.attack_timer = AttackTimer::Idle;
@ -665,9 +657,8 @@ impl<'a> Player<'a> {
2
};
let tag = self.sword.jump_tag();
let sprite = controller
.get_sprite(tag.get_animation_sprite(frame as usize))
.unwrap();
let sprite =
controller.get_sprite(tag.get_animation_sprite(frame as usize));
self.entity.sprite.set_sprite(sprite);
if x != Tri::Zero {
@ -689,9 +680,8 @@ impl<'a> Player<'a> {
*a -= 1;
let frame = self.sword.jump_attack_frame(*a);
let tag = self.sword.jump_attack_tag();
let sprite = controller
.get_sprite(tag.get_animation_sprite(frame as usize))
.unwrap();
let sprite =
controller.get_sprite(tag.get_animation_sprite(frame as usize));
self.entity.sprite.set_sprite(sprite);
hurtbox = self.sword.air_attack_hurtbox(frame);
@ -854,7 +844,7 @@ impl BatData {
}
let sprite = BAT_IDLE.get_sprite(self.sprite_offset as usize / 8);
let sprite = controller.get_sprite(sprite).unwrap();
let sprite = controller.get_sprite(sprite);
entity.sprite.set_sprite(sprite);
@ -889,7 +879,7 @@ impl BatData {
}
let sprite = BAT_IDLE.get_sprite(self.sprite_offset as usize / 2);
let sprite = controller.get_sprite(sprite).unwrap();
let sprite = controller.get_sprite(sprite);
entity.sprite.set_sprite(sprite);
@ -916,7 +906,7 @@ impl BatData {
BatState::Dead => {
const BAT_DEAD: &Tag = TAG_MAP.get("bat dead");
let sprite = BAT_DEAD.get_sprite(0);
let sprite = controller.get_sprite(sprite).unwrap();
let sprite = controller.get_sprite(sprite);
entity.sprite.set_sprite(sprite);
@ -984,7 +974,7 @@ impl SlimeData {
const IDLE: &Tag = TAG_MAP.get("slime idle");
let sprite = IDLE.get_sprite(self.sprite_offset as usize / 16);
let sprite = controller.get_sprite(sprite).unwrap();
let sprite = controller.get_sprite(sprite);
entity.sprite.set_sprite(sprite);
@ -1024,7 +1014,7 @@ impl SlimeData {
const CHASE: &Tag = TAG_MAP.get("Slime jump");
let sprite = CHASE.get_sprite(frame as usize);
let sprite = controller.get_sprite(sprite).unwrap();
let sprite = controller.get_sprite(sprite);
entity.sprite.set_sprite(sprite);
@ -1054,7 +1044,7 @@ impl SlimeData {
if *count < 5 * 4 {
const DEATH: &Tag = TAG_MAP.get("Slime death");
let sprite = DEATH.get_sprite(*count as usize / 4);
let sprite = controller.get_sprite(sprite).unwrap();
let sprite = controller.get_sprite(sprite);
entity.sprite.set_sprite(sprite);
*count += 1;
@ -1122,7 +1112,7 @@ impl MiniFlameData {
}
} else {
let sprite = ANGRY.get_animation_sprite(self.sprite_offset as usize / 8);
let sprite = controller.get_sprite(sprite).unwrap();
let sprite = controller.get_sprite(sprite);
entity.sprite.set_sprite(sprite);
entity.velocity = (0.into(), Number::new(-1) / Number::new(4)).into();
@ -1170,7 +1160,7 @@ impl MiniFlameData {
}
let sprite = ANGRY.get_animation_sprite(self.sprite_offset as usize / 2);
let sprite = controller.get_sprite(sprite).unwrap();
let sprite = controller.get_sprite(sprite);
entity.sprite.set_sprite(sprite);
}
MiniFlameState::Dead => {
@ -1182,7 +1172,7 @@ impl MiniFlameData {
const DEATH: &Tag = TAG_MAP.get("angry boss dead");
let sprite = DEATH.get_animation_sprite(self.sprite_offset as usize / 12);
let sprite = controller.get_sprite(sprite).unwrap();
let sprite = controller.get_sprite(sprite);
entity.sprite.set_sprite(sprite);
self.sprite_offset += 1;
@ -1243,7 +1233,7 @@ impl EmuData {
const IDLE: &Tag = TAG_MAP.get("emu - idle");
let sprite = IDLE.get_sprite(self.sprite_offset as usize / 16);
let sprite = controller.get_sprite(sprite).unwrap();
let sprite = controller.get_sprite(sprite);
entity.sprite.set_sprite(sprite);
if (entity.position.y - player.entity.position.y).abs() < 10.into() {
@ -1290,7 +1280,7 @@ impl EmuData {
const WALK: &Tag = TAG_MAP.get("emu-walk");
let sprite = WALK.get_sprite(self.sprite_offset as usize / 2);
let sprite = controller.get_sprite(sprite).unwrap();
let sprite = controller.get_sprite(sprite);
entity.sprite.set_sprite(sprite);
let gravity: Number = 1.into();
@ -1345,7 +1335,7 @@ impl EmuData {
const DEATH: &Tag = TAG_MAP.get("emu - die");
let sprite = DEATH.get_animation_sprite(self.sprite_offset as usize / 4);
let sprite = controller.get_sprite(sprite).unwrap();
let sprite = controller.get_sprite(sprite);
entity.sprite.set_sprite(sprite);
self.sprite_offset += 1;
@ -1415,7 +1405,7 @@ impl<'a> Enemy<'a> {
let mut entity = Entity::new(object_controller, enemy_data.collision_mask());
let sprite = enemy_data.sprite();
let sprite = object_controller.get_sprite(sprite).unwrap();
let sprite = object_controller.get_sprite(sprite);
entity.sprite.set_sprite(sprite);
entity.sprite.show();
@ -1479,7 +1469,7 @@ impl ParticleData {
const DUST: &Tag = TAG_MAP.get("dust");
let sprite = DUST.get_sprite(*frame as usize / 3);
let sprite = controller.get_sprite(sprite).unwrap();
let sprite = controller.get_sprite(sprite);
entity.sprite.set_sprite(sprite);
@ -1493,7 +1483,7 @@ impl ParticleData {
const HEALTH: &Tag = TAG_MAP.get("Heath");
let sprite = HEALTH.get_animation_sprite(*frame as usize / 3);
let sprite = controller.get_sprite(sprite).unwrap();
let sprite = controller.get_sprite(sprite);
entity.sprite.set_sprite(sprite);
@ -1519,7 +1509,7 @@ impl ParticleData {
ParticleData::BossHealer(frame, target) => {
const HEALTH: &Tag = TAG_MAP.get("Heath");
let sprite = HEALTH.get_animation_sprite(*frame as usize / 3);
let sprite = controller.get_sprite(sprite).unwrap();
let sprite = controller.get_sprite(sprite);
entity.sprite.set_sprite(sprite);
@ -1683,7 +1673,7 @@ impl<'a> FollowingBoss<'a> {
const BOSS: &Tag = TAG_MAP.get("happy boss");
let sprite = BOSS.get_animation_sprite(frame as usize);
let sprite = controller.get_sprite(sprite).unwrap();
let sprite = controller.get_sprite(sprite);
self.entity.sprite.set_sprite(sprite);
@ -1819,7 +1809,7 @@ impl<'a> Boss<'a> {
const BOSS: &Tag = TAG_MAP.get("Boss");
let sprite = BOSS.get_animation_sprite(frame as usize);
let sprite = object_controller.get_sprite(sprite).unwrap();
let sprite = object_controller.get_sprite(sprite);
self.entity.sprite.set_sprite(sprite);