very bad collision(work in progress)
This commit is contained in:
@@ -2,7 +2,10 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "collision.h"
|
#include "collision.h"
|
||||||
|
<<<<<<< HEAD
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
|
=======
|
||||||
|
>>>>>>> dff3a5d2c4b8cd3d6d86ab9792e394cd0d27a619
|
||||||
|
|
||||||
void checkCollision(){
|
void checkCollision(){
|
||||||
float playerx=0.0;
|
float playerx=0.0;
|
||||||
@@ -21,6 +24,7 @@ void checkCollision(){
|
|||||||
if(playerx-(plrsize/2)<objposx+(objsize/2) && playerx-(plrsize/2)>objposx-(objsize/2)){
|
if(playerx-(plrsize/2)<objposx+(objsize/2) && playerx-(plrsize/2)>objposx-(objsize/2)){
|
||||||
ApplyForce(
|
ApplyForce(
|
||||||
e,
|
e,
|
||||||
|
<<<<<<< HEAD
|
||||||
(Vector2){10000, 1000}
|
(Vector2){10000, 1000}
|
||||||
);
|
);
|
||||||
if(dir){
|
if(dir){
|
||||||
@@ -35,6 +39,14 @@ void checkCollision(){
|
|||||||
(Vector2){-(curhorvel*3), 1000}
|
(Vector2){-(curhorvel*3), 1000}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
(Vector2){1000, 1000}
|
||||||
|
);
|
||||||
|
ApplyForce(
|
||||||
|
player,
|
||||||
|
(Vector2){-1000, 1000}
|
||||||
|
);
|
||||||
|
>>>>>>> dff3a5d2c4b8cd3d6d86ab9792e394cd0d27a619
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|||||||
@@ -7,7 +7,10 @@
|
|||||||
|
|
||||||
// let's a go!
|
// let's a go!
|
||||||
float curhorvel=0.0f; //current horizonatal velocity
|
float curhorvel=0.0f; //current horizonatal velocity
|
||||||
|
<<<<<<< HEAD
|
||||||
bool dir=0;
|
bool dir=0;
|
||||||
|
=======
|
||||||
|
>>>>>>> dff3a5d2c4b8cd3d6d86ab9792e394cd0d27a619
|
||||||
void UpdatePlayerControls(void)
|
void UpdatePlayerControls(void)
|
||||||
{
|
{
|
||||||
// if there isn't a player, you probably can't do much
|
// 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 a key pressed, push player to the left
|
||||||
if (IsKeyDown(KEY_A))
|
if (IsKeyDown(KEY_A))
|
||||||
{
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
dir=1;
|
dir=1;
|
||||||
|
=======
|
||||||
|
>>>>>>> dff3a5d2c4b8cd3d6d86ab9792e394cd0d27a619
|
||||||
if(curhorvel<MAX_PLAYER_SPEED){
|
if(curhorvel<MAX_PLAYER_SPEED){
|
||||||
curhorvel=curhorvel*PLAYER_SPEED_FACTOR;
|
curhorvel=curhorvel*PLAYER_SPEED_FACTOR;
|
||||||
}
|
}
|
||||||
@@ -32,7 +38,10 @@ void UpdatePlayerControls(void)
|
|||||||
// if d key pressed, push player to the right
|
// if d key pressed, push player to the right
|
||||||
else if (IsKeyDown(KEY_D))
|
else if (IsKeyDown(KEY_D))
|
||||||
{
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
dir=0;
|
dir=0;
|
||||||
|
=======
|
||||||
|
>>>>>>> dff3a5d2c4b8cd3d6d86ab9792e394cd0d27a619
|
||||||
if(curhorvel<=MAX_PLAYER_SPEED){
|
if(curhorvel<=MAX_PLAYER_SPEED){
|
||||||
curhorvel=curhorvel*PLAYER_SPEED_FACTOR;
|
curhorvel=curhorvel*PLAYER_SPEED_FACTOR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,11 @@
|
|||||||
|
|
||||||
// FUNction declaration! yay!!!
|
// FUNction declaration! yay!!!
|
||||||
// run by main.c constantly to allow player input.
|
// run by main.c constantly to allow player input.
|
||||||
|
<<<<<<< HEAD
|
||||||
extern bool dir;
|
extern bool dir;
|
||||||
extern float curhorvel;
|
extern float curhorvel;
|
||||||
|
=======
|
||||||
|
>>>>>>> dff3a5d2c4b8cd3d6d86ab9792e394cd0d27a619
|
||||||
void UpdatePlayerControls(void);
|
void UpdatePlayerControls(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user