diff --git a/lib/sb b/lib/sb index 3444afc..7e31b5a 160000 --- a/lib/sb +++ b/lib/sb @@ -1 +1 @@ -Subproject commit 3444afc2c1291814d97efb94ca8aecb6e6698c40 +Subproject commit 7e31b5a1c00f38dbd9d667f7e4174a5341ac550f diff --git a/src/Model.cpp b/src/Model.cpp index eaf8028..a9d18e3 100644 --- a/src/Model.cpp +++ b/src/Model.cpp @@ -1,4 +1,4 @@ -/* Cuckoo by @ohsqueezy [ohsqueezy.itch.io] */ +/* Pepy by @ohsqueezy [ohsqueezy.itch.io] */ #include "Model.hpp" diff --git a/src/Pepy.cpp b/src/Pepy.cpp index 51dbf56..32061c2 100644 --- a/src/Pepy.cpp +++ b/src/Pepy.cpp @@ -245,11 +245,12 @@ void Pepy::update() float distance = glm::distance(ball_center, cuckoo_center); if (shaking) { + /* The ball will bounce back toward the center of the cuckoo if it's a certain distance away from it. */ if (distance > 0.65f) { - float angle = glm::atan(cuckoo_center.y - ball_center.y, cuckoo_center.x - ball_center.x); + /* Calculate the angle of the ball and add speed. */ + ball.second.x = sb::angle_between(ball_center, cuckoo_center); ball.second.y += 0.0005f; - ball.second.x = angle + glm::half_pi(); } } glm::vec2 step = sb::velocity_to_delta(ball.second); diff --git a/src/Pepy.hpp b/src/Pepy.hpp index b1c2fed..d7b46a0 100644 --- a/src/Pepy.hpp +++ b/src/Pepy.hpp @@ -69,6 +69,7 @@ private: float hue_offset = 0.0f, time_seconds = 0.0f, aspect_ratio = 1.0f, return_speed = 0.0075f, cuckoo_speed = 0.0f, countdown = 10.0f; glm::mat4 orthographic_projection {1}; glm::vec3 cuckoo_offset {0.0f, 0.0f, 0.0f}; + glm::vec2 cuckoo_velocity {0.0f, 0.0f}; bool grabbed = false; glm::ivec2 mouse_pixel = {0, 0}; Plane background;