aboutsummaryrefslogtreecommitdiffstats
path: root/src/clicky.c
diff options
context:
space:
mode:
authornathansmith117 <thenathansmithsmith@gmail.com>2024-02-21 19:29:29 +0000
committernathansmith117 <thenathansmithsmith@gmail.com>2024-02-21 19:29:29 +0000
commit1ce1a705c61064e44f83c772b70ee9b208a4c289 (patch)
treef5e593fc4ea11a2a3dd3a186679421086af4a01e /src/clicky.c
parent1a677439d001e9ef481c6e932b6ca78c3733f531 (diff)
downloadPenguinYippies-1ce1a705c61064e44f83c772b70ee9b208a4c289.tar.gz
PenguinYippies-1ce1a705c61064e44f83c772b70ee9b208a4c289.tar.bz2
PenguinYippies-1ce1a705c61064e44f83c772b70ee9b208a4c289.zip
Working on pixal collision thingy
Diffstat (limited to 'src/clicky.c')
-rw-r--r--src/clicky.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/clicky.c b/src/clicky.c
index 4f901b0..88b23ce 100644
--- a/src/clicky.c
+++ b/src/clicky.c
@@ -1,7 +1,7 @@
#include "clicky.h"
#include "game.h"
#include "assets.h"
-#include <raylib.h>
+#include "util.h"
void updateClicky(Game* game, Clicky* clicky)
{
@@ -12,7 +12,16 @@ void updatePenguinLol(Game* game, Clicky* clicky)
{
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
{
- replayAnimation(&clicky->animation);
+ Rectangle clickRect = clicky->rect;
+ clickRect.width /= 2.0;
+ clickRect.height /= 2.0;
+ clickRect.x += clickRect.width / 2.0;
+ clickRect.y += clickRect.height / 2.0;
+
+ if (CheckCollisionPointRec(getScaledMousePosition(), clickRect))
+ {
+ replayAnimation(&clicky->animation);
+ }
}
// Run animation and update.