Skip to content

Commit 1422a1c

Browse files
committed
ヘリコプターevent完成
1 parent b9dd06f commit 1422a1c

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

Don't_push/Don't_push/source/game.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,16 @@ bool circular_motion::draw(const dxle::Graph2D::Texture2D& img) const {
104104
dxle::pointd circular_motion::get_pos() const NOEXCEPT {
105105
return this->m_current_;
106106
}
107-
static void extruded(size_t& fall_frame, dxle::pointi& move_target, const dxle::pointi& move_cause, const dxle::pointi& target_img_size, const int first_y) {
107+
static void extruded(size_t& fall_frame, dxle::pointi& move_target, dxle::Graph2D::Screen& scr, const dxle::pointi& move_cause, DxGHandle& imgarr, const int first_y) {
108108
constexpr double g = 9.80665;
109-
if (move_target.x + target_img_size.x < WINDOW_WIDTH / 4) {
109+
if (move_target.x + scr.GetGraphSize().x < WINDOW_WIDTH / 4) {
110110
++fall_frame;
111-
move_target.y = first_y + static_cast<int>(g / 2 * fall_frame);
111+
move_target.y = first_y + static_cast<int>(12.5 * g / 2 * fall_frame);//自由落下
112+
if (1 == fall_frame) {
113+
scr.DrawnOn([&imgarr]() {imgarr.DrawExtendGraph({}, { imgarr.GetGraphSize().x / 3, imgarr.GetGraphSize().y / 3 }, true); });
114+
}
112115
}
113-
if (move_cause.x < move_target.x + target_img_size.x) move_target.x = move_cause.x - target_img_size.x;
116+
if (move_cause.x < move_target.x + scr.GetGraphSize().x) move_target.x = move_cause.x - scr.GetGraphSize().x;
114117
}
115118
Status game_c::helicopter_event() {
116119
this->m_state_.fllush();
@@ -120,7 +123,6 @@ Status game_c::helicopter_event() {
120123
constexpr int fadeout_time_frame = 200;
121124
//fade out
122125
for (int i = 0; i < fadeout_time_frame && (is_normal_state = normal_con_f()) && m_state_.update() && !m_state_.esc(); ++i) {
123-
//this->m_img_["Presentation1"].DrawGraph({}, false);
124126
this->m_back_img_.DrawGraph({}, false);
125127
SetDrawBlendMode(DX_BLENDMODE_ALPHA, static_cast<int>((fadeout_time_frame - i) * 256.0/ fadeout_time_frame));
126128
this->m_img_["back_str"].DrawGraph({}, true);
@@ -139,16 +141,13 @@ Status game_c::helicopter_event() {
139141
const int first_yB = m_p_.y;
140142
while ((is_normal_state = normal_con_f()) && m_state_.update() && !m_state_[KEY_INPUT_Z] && !m_state_.esc() && helicopter.update()) {
141143
this->m_back_img_.DrawGraph({}, false);
142-
SetDrawBlendMode(DX_BLENDMODE_ALPHA, 128);
143-
this->m_img_["Presentation1"].DrawGraph({}, false);
144-
SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0);
145-
extruded(fall_frameB, m_p_, static_cast<dxle::pointi>(helicopter.get_pos()), this->m_bouninngennB_.GetGraphSize(), first_yB);
146-
extruded(fall_frameA, ningenA, m_p_, this->m_bouninngennA_.GetGraphSize(), first_yA);
144+
extruded(fall_frameB, m_p_, this->m_bouninngennB_, static_cast<dxle::pointi>(helicopter.get_pos()), this->m_img_["bouninngennB_fall"], first_yB);
145+
extruded(fall_frameA, ningenA, this->m_bouninngennA_, m_p_, this->m_img_["bouninngennA_fall"], first_yA);
147146
this->m_bouninngennA_.DrawGraph(ningenA, true);
148147
this->m_bouninngennB_.DrawGraph(this->m_p_, true);
149-
//helicopter_img.DrawGraph({ m_window_s_.x * 23 / 26, m_window_s_.y * 1 / 82}, true);
150148
helicopter.draw(helicopter_img);
151-
WaitKey();
149+
//WaitKey();
150+
if (WINDOW_HEIGHT < ningenA.y && WINDOW_HEIGHT < this->m_p_.y) break;//ふたりとも落ちたらゲーム終わり
152151
}
153152
if (!is_normal_state) throw std::runtime_error("ProcessMessage() return -1.");
154153
if (m_state_.esc()) throw normal_exit();

0 commit comments

Comments
 (0)