Compare commits
2 Commits
dff3a5d2c4
...
21bd0c204e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21bd0c204e | ||
|
|
22377c6f1a |
@@ -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{
|
||||
|
||||
12
src/player.c
12
src/player.c
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user