very bad collision(work in progress)

This commit is contained in:
swim67667
2026-06-22 01:41:15 -04:00
3 changed files with 24 additions and 0 deletions

View File

@@ -2,7 +2,10 @@
#include <math.h>
#include "config.h"
#include "collision.h"
<<<<<<< HEAD
#include "player.h"
=======
>>>>>>> dff3a5d2c4b8cd3d6d86ab9792e394cd0d27a619
void checkCollision(){
float playerx=0.0;
@@ -21,6 +24,7 @@ void checkCollision(){
if(playerx-(plrsize/2)<objposx+(objsize/2) && playerx-(plrsize/2)>objposx-(objsize/2)){
ApplyForce(
e,
<<<<<<< HEAD
(Vector2){10000, 1000}
);
if(dir){
@@ -35,6 +39,14 @@ void checkCollision(){
(Vector2){-(curhorvel*3), 1000}
);
}
=======
(Vector2){1000, 1000}
);
ApplyForce(
player,
(Vector2){-1000, 1000}
);
>>>>>>> dff3a5d2c4b8cd3d6d86ab9792e394cd0d27a619
}
}
else{

View File

@@ -7,7 +7,10 @@
// let's a go!
float curhorvel=0.0f; //current horizonatal velocity
<<<<<<< HEAD
bool dir=0;
=======
>>>>>>> dff3a5d2c4b8cd3d6d86ab9792e394cd0d27a619
void UpdatePlayerControls(void)
{
// if there isn't a player, you probably can't do much
@@ -20,7 +23,10 @@ void UpdatePlayerControls(void)
// if a key pressed, push player to the left
if (IsKeyDown(KEY_A))
{
<<<<<<< HEAD
dir=1;
=======
>>>>>>> dff3a5d2c4b8cd3d6d86ab9792e394cd0d27a619
if(curhorvel<MAX_PLAYER_SPEED){
curhorvel=curhorvel*PLAYER_SPEED_FACTOR;
}
@@ -32,7 +38,10 @@ void UpdatePlayerControls(void)
// if d key pressed, push player to the right
else if (IsKeyDown(KEY_D))
{
<<<<<<< HEAD
dir=0;
=======
>>>>>>> dff3a5d2c4b8cd3d6d86ab9792e394cd0d27a619
if(curhorvel<=MAX_PLAYER_SPEED){
curhorvel=curhorvel*PLAYER_SPEED_FACTOR;
}

View File

@@ -3,8 +3,11 @@
// FUNction declaration! yay!!!
// run by main.c constantly to allow player input.
<<<<<<< HEAD
extern bool dir;
extern float curhorvel;
=======
>>>>>>> dff3a5d2c4b8cd3d6d86ab9792e394cd0d27a619
void UpdatePlayerControls(void);
#endif