Compare commits

...

2 Commits

Author SHA1 Message Date
swim67667
21bd0c204e very bad collision(work in progress) 2026-06-22 01:41:15 -04:00
swim67667
22377c6f1a very bad collision(work in progress) 2026-06-22 01:29:58 -04:00
4 changed files with 38 additions and 0 deletions

View File

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

View File

@@ -7,6 +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
@@ -19,6 +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;
}
@@ -30,6 +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,6 +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

BIN
wrldbox

Binary file not shown.