Skip to content

Commit

Permalink
graphical changes
Browse files Browse the repository at this point in the history
  • Loading branch information
evanbowman committed Mar 19, 2020
1 parent 10a2861 commit b64c178
Show file tree
Hide file tree
Showing 13 changed files with 499 additions and 468 deletions.
2 changes: 1 addition & 1 deletion source/camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void Camera::update(Platform& pfrm,


static const std::array<Float, 5> shake_constants = {
{1.5f, -2.5f, 1.5f, -1.f, 0.5f}};
{3.f, -5.f, 3.f, -2.f, 1.f}};

const auto center = interpolate(
target,
Expand Down
37 changes: 33 additions & 4 deletions source/entity/effects/laser.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "laser.hpp"
#include "number/random.hpp"


static constexpr const Float move_rate = 0.0002f;
Expand All @@ -10,7 +11,7 @@ Laser::Laser(const Vec2<Float>& position, Cardinal dir)
set_position(position);

sprite_.set_size(Sprite::Size::w16_h32);
sprite_.set_origin({8, 8});
sprite_.set_origin({8, 16});
sprite_.set_position(position);

sprite_.set_texture_index([this] {
Expand All @@ -22,21 +23,49 @@ Laser::Laser(const Vec2<Float>& position, Cardinal dir)
return TextureMap::h_laser;
}
}());

if (dir_ == Cardinal::south) {
sprite_.set_flip({false, true});
} else if (dir_ == Cardinal::east) {
sprite_.set_flip({true, false});
}
}


void Laser::update(Platform& pf, Game& game, Microseconds dt)
{
// wait till we've had one update cycle to check visibility
if (timer_ == 0) {
timer_ += dt;
} else {
if (timer_ != 0) {
if (not this->visible()) {
this->kill();
return;
}
}

timer_ += dt;

if (timer_ > milliseconds(20)) {
timer_ = 0;
const auto flip = sprite_.get_flip();
const auto spr = sprite_.get_texture_index();
if (dir_ == Cardinal::north or dir_ == Cardinal::south) {
sprite_.set_flip({static_cast<bool>(random_choice<2>()), flip.y});
} else {
sprite_.set_flip({flip.x, static_cast<bool>(random_choice<2>())});
}
if (random_choice<3>() == 0) {
if (spr == TextureMap::v_laser) {
sprite_.set_texture_index(TextureMap::v_laser2);
} else if (spr == TextureMap::v_laser2) {
sprite_.set_texture_index(TextureMap::v_laser);
} else if (spr == TextureMap::h_laser) {
sprite_.set_texture_index(TextureMap::h_laser2);
} else if (spr == TextureMap::h_laser2) {
sprite_.set_texture_index(TextureMap::h_laser);
}
}
}

switch (dir_) {
case Cardinal::north:
position_.y -= dt * move_rate;
Expand Down
2 changes: 1 addition & 1 deletion source/entity/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ void Blaster::update(Platform& pf, Game& game, Microseconds dt, Cardinal dir)

sprite_.set_position(position_);

if (reload_) {
if (reload_ > 0) {
reload_ -= dt;
}
}
Expand Down
2 changes: 1 addition & 1 deletion source/graphics/bgr_overlay.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// + 156 tiles not compressed
// Total size: 512 + 4992 = 5504
//
// Time-stamp: 2020-03-18, 22:00:13
// Time-stamp: 2020-03-19, 13:25:13
// Exported by Cearn's GBA Image Transmogrifier, v
// ( http://www.coranac.com/projects/#grit )
//
Expand Down
2 changes: 1 addition & 1 deletion source/graphics/bgr_overlay.s
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@ + 156 tiles not compressed
@ Total size: 512 + 4992 = 5504
@
@ Time-stamp: 2020-03-18, 22:00:13
@ Time-stamp: 2020-03-19, 13:25:13
@ Exported by Cearn's GBA Image Transmogrifier, v
@ ( http://www.coranac.com/projects/#grit )
@
Expand Down
2 changes: 1 addition & 1 deletion source/graphics/bgr_spritesheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// + 1024 tiles Metatiled by 2x4 not compressed
// Total size: 512 + 32768 = 33280
//
// Time-stamp: 2020-03-18, 22:00:13
// Time-stamp: 2020-03-19, 13:25:13
// Exported by Cearn's GBA Image Transmogrifier, v
// ( http://www.coranac.com/projects/#grit )
//
Expand Down
902 changes: 451 additions & 451 deletions source/graphics/bgr_spritesheet.s

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion source/graphics/bgr_tilesheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// + 468 tiles Metatiled by 4x3 not compressed
// Total size: 512 + 14976 = 15488
//
// Time-stamp: 2020-03-18, 22:00:13
// Time-stamp: 2020-03-19, 13:25:13
// Exported by Cearn's GBA Image Transmogrifier, v
// ( http://www.coranac.com/projects/#grit )
//
Expand Down
2 changes: 1 addition & 1 deletion source/graphics/bgr_tilesheet.s
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@ + 468 tiles Metatiled by 4x3 not compressed
@ Total size: 512 + 14976 = 15488
@
@ Time-stamp: 2020-03-18, 22:00:13
@ Time-stamp: 2020-03-19, 13:25:13
@ Exported by Cearn's GBA Image Transmogrifier, v
@ ( http://www.coranac.com/projects/#grit )
@
Expand Down
2 changes: 1 addition & 1 deletion source/graphics/color.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// values.
enum class ColorConstant {
null,
electric_blue, // #48F8F8
electric_blue, // #00FFFF
spanish_crimson, // #E81858
aerospace_orange, // #FD5200
rich_black, // #000010
Expand Down
10 changes: 6 additions & 4 deletions source/graphics/sprite.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,12 @@ enum TextureMap : TextureIndex {
snake_head_down = 67,
snake_head_up = 68,
h_laser = 69,
v_laser = 70,
h_blaster = 71,
v_blaster = 72,
explosion = 73,
h_laser2 = 70,
v_laser = 71,
v_laser2 = 72,
h_blaster = 73,
v_blaster = 74,
explosion = 75,
};


Expand Down
2 changes: 1 addition & 1 deletion source/platform/gba_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ const Color& real_color(ColorConstant k)
return spn_crimson;

case ColorConstant::electric_blue:
static const Color el_blue(9, 31, 31);
static const Color el_blue(0, 31, 31);
return el_blue;

case ColorConstant::aerospace_orange:
Expand Down
Binary file modified spritesheet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b64c178

Please sign in to comment.