diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2024-12-28 12:15:39 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2024-12-28 12:15:39 +0100 |
commit | deb1cd4732fb3a880cd10ce677e62fc2aac974a0 (patch) | |
tree | 28f02f1f4d88687688e9670c85f409c90bfc041d /game/mainmenu/IShowScript.cpp | |
parent | f91eff6285f651f5c3e310927026f419e67657ab (diff) |
interface scripts added
Diffstat (limited to 'game/mainmenu/IShowScript.cpp')
-rw-r--r-- | game/mainmenu/IShowScript.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/game/mainmenu/IShowScript.cpp b/game/mainmenu/IShowScript.cpp new file mode 100644 index 0000000..adb6e89 --- /dev/null +++ b/game/mainmenu/IShowScript.cpp @@ -0,0 +1,26 @@ +#include "IShowScript.h" +#include "api/Rigidbody.h" +#include "api/Transform.h" +#include "iostream" +#include <crepe/api/Camera.h> +#include "MainMenuConfig.h" + +using namespace crepe; +using namespace std; + +void IShowScript::frame_update(crepe::duration_t delta_time){ + if(this->transition) + { + cout << "transition:" << velocity << std::endl; + Transform & cam = this->get_components_by_name<Transform>(MainMenuConfig::CAMERA_NAME).front(); + if(velocity < MainMenuConfig::VELOCITY_MAX && cam.position.x < MainMenuConfig::SLOW_DOWN) velocity += MainMenuConfig::VELOCITY_STEP * delta_time.count(); + else if(velocity > 20) velocity -= MainMenuConfig::VELOCITY_STEP * delta_time.count(); + if(cam.position.x < MainMenuConfig::END) cam.position.x += (velocity * delta_time.count()); + if(cam.position.x >= MainMenuConfig::END) + { + this->set_next_scene(this->get_scene_name()); + } + + } +} + |