From 616e1db4665f8d51fc61a236f1504ec65e0cd300 Mon Sep 17 00:00:00 2001 From: SemvdH Date: Tue, 24 Aug 2021 22:36:41 +0200 Subject: [PATCH] {EDIT} change movement speed of enemies and player --- src/main.c | 2 +- src/sprites/sprites.h | 2 ++ src/system/control_input.c | 2 +- src/system/control_input.h | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 1509497..55deee6 100644 --- a/src/main.c +++ b/src/main.c @@ -115,7 +115,7 @@ void init_sprites() // add simple enemies for (i = 0; i < SIMPLE_ENEMY_MAX_AMOUNT; i++) { - ENEMY_SPRITE e = {NONACTIVE, SIMPLE, 20 * i + 10, 10, RGBA8(245, 90, 66, 255), 1.0}; + ENEMY_SPRITE e = {NONACTIVE, SIMPLE, 0,0, SIMPLE_ENEMY_COLOR, SIMPLE_ENEMY_MOVEMENT_SPEED}; enemies[i] = e; enemy_count++; } diff --git a/src/sprites/sprites.h b/src/sprites/sprites.h index b5f25be..5cf5e9d 100644 --- a/src/sprites/sprites.h +++ b/src/sprites/sprites.h @@ -25,6 +25,8 @@ #define PLAYER_Y_OFFSET (PLAYER_HEIGTH / 2) // the center y of the player is in the middle #define SIMPLE_ENEMY_SIZE 9.0 +#define SIMPLE_ENEMY_MOVEMENT_SPEED 1.5 +#define SIMPLE_ENEMY_COLOR (RGBA8(245, 90, 66, 255)) #define COMPLEX_ENEMY_SIZE 9.0 #define SMOKE_START_RADIUS 8.0 diff --git a/src/system/control_input.c b/src/system/control_input.c index 0bb415a..876cac7 100644 --- a/src/system/control_input.c +++ b/src/system/control_input.c @@ -20,5 +20,5 @@ void ctrl_input_get_rightstick(SceCtrlData *pad, stick_data *stickdata) float ctrl_input_calc_value(int16_t pos, SceUInt64 deltaTime) { - return (float)((pos) * (deltaTime / 1000.0)); + return (float)((pos) * (deltaTime / 1000.0)) * PLAYER_SPEED; } \ No newline at end of file diff --git a/src/system/control_input.h b/src/system/control_input.h index 940a4a7..803989a 100644 --- a/src/system/control_input.h +++ b/src/system/control_input.h @@ -4,6 +4,8 @@ #include #include +#define PLAYER_SPEED 1.5 + /** * @brief a struct that holds the x and y pos for a stick. < 0 is left or down, > 0 is right or up. Value goes from 0 to 128 *