Compare commits

...

25 Commits

Author SHA1 Message Date
swim67667
fded40cbd9 collision/more physics updates
All checks were successful
Build Project / build (ubuntu-latest) (push) Successful in 17m55s
2026-06-27 00:54:11 -04:00
40747ec508 fully fixed and skips windows because we dont have a windows runner
All checks were successful
Build Project / build (ubuntu-latest) (push) Successful in 21m18s
2026-06-26 23:55:04 -04:00
9af9cef7ad Update .gitea/workflows/build.yaml
Some checks failed
Build Project / build (ubuntu-latest) (push) Successful in 23m20s
Build Project / build (windows-latest) (push) Has been cancelled
2026-06-26 23:27:27 -04:00
a3b5e6abee Update .gitea/workflows/build.yaml
Some checks failed
Build Project / build (windows-latest) (push) Waiting to run
Build Project / build (ubuntu-latest) (push) Failing after 18m1s
2026-06-26 23:07:47 -04:00
swim67667
f112c37e9e adding top collision
Some checks failed
Build Project / build (windows-latest) (push) Waiting to run
Build Project / build (ubuntu-latest) (push) Failing after 8m17s
2026-06-24 22:46:43 -04:00
257be0b3c5 build.yaml 3: someone kill me! (joking)
Some checks failed
Build Project / build (ubuntu-latest) (push) Failing after 7m46s
Build Project / build (windows-latest) (push) Has been cancelled
2026-06-24 14:05:10 -04:00
bdb6a0aca0 build.yaml 2: electric boogaloo 2026-06-24 14:04:15 -04:00
swim67667
0dd35c52c0 yup
Some checks failed
Build Project / build (push) Failing after 6m15s
2026-06-24 13:34:34 -04:00
swim67667
47f73722b9 im sick of making commit titles- fixing stuff
Some checks failed
Build Project / build (push) Failing after 6m56s
2026-06-24 12:59:55 -04:00
swim67667
9dee043d95 less messed up collision
Some checks failed
Build Project / build (push) Failing after 5m52s
2026-06-24 12:47:00 -04:00
swim67667
c079ca620f horizontal collision works
Some checks failed
Build Project / build (push) Failing after 10m39s
2026-06-24 11:46:32 -04:00
swim67667
c29f652cdc made it compileable for macos
Some checks failed
Build Project / build (push) Has been cancelled
2026-06-24 11:42:00 -04:00
2917fd3152 Update README.md
Some checks failed
Build Project / build (push) Failing after 5m58s
2026-06-24 11:29:14 -04:00
swim67667
466d62c023 more
Some checks failed
Build Project / build (push) Failing after 23m56s
2026-06-24 01:30:18 -04:00
swim67667
78597f14c0 commit sum more bs
Some checks failed
Build Project / build (push) Has been cancelled
2026-06-24 00:49:30 -04:00
swim67667
b7fef7bee3 bugfixing
Some checks failed
Build Project / build (push) Has been cancelled
2026-06-24 00:31:07 -04:00
swim67667
3adef4de7b added macos makefile
Some checks failed
Build Project / build (push) Has been cancelled
2026-06-24 00:26:52 -04:00
e8a6af63af fixed it!!!
Some checks failed
Build Project / build (push) Has been cancelled
2026-06-23 10:25:01 -04:00
8163a4641e optimised
Some checks failed
Build Project / build (push) Has been cancelled
2026-06-23 10:20:10 -04:00
53c8a13578 we must first make a gitea runner in order for this to work
Some checks failed
Build Project / build (push) Has been cancelled
2026-06-23 10:07:54 -04:00
43d8ddd0ec will build our wrldbox when new commit is made
Some checks failed
Build Project / build (push) Has been cancelled
2026-06-23 10:04:27 -04:00
bd0ffff93f fixed comments 2026-06-23 10:00:59 -04:00
013fab7c89 fixed bad array definition 2026-06-23 10:00:19 -04:00
swim67667
06d5ae6674 more robust data collection 2026-06-22 23:30:42 -04:00
swim67667
51b15daf2c fixed weird text added in 2026-06-22 01:46:21 -04:00
13 changed files with 177 additions and 78 deletions

View File

@@ -0,0 +1,87 @@
name: Build Project
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
# - windows-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
gcc \
g++ \
make \
git \
cmake \
libasound2-dev \
mesa-common-dev \
libx11-dev \
libxrandr-dev \
libxinerama-dev \
libxcursor-dev \
libxi-dev \
libgl1-mesa-dev \
libglu1-mesa-dev
- name: Build & Install Raylib (Linux)
if: runner.os == 'Linux'
run: |
git clone --depth 1 https://github.com/raysan5/raylib.git
cd raylib/src
make PLATFORM=PLATFORM_DESKTOP
sudo make install
# - name: Install MSYS2 and Raylib (Windows)
# if: runner.os == 'Windows'
# uses: msys2/setup-msys2@v2
# with:
# msystem: MINGW64
# update: true
# install: >
# mingw-w64-x86_64-gcc
# mingw-w64-x86_64-make
# mingw-w64-x86_64-raylib
- name: Build (Linux)
if: runner.os == 'Linux'
run: make
# - name: Build (Windows)
# if: runner.os == 'Windows'
# shell: msys2 {0}
# run: make
- name: Upload Linux Artifact
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
with:
name: wrldbox-linux
path: wrldbox
# - name: Upload Windows Artifact
# if: runner.os == 'Windows'
# uses: actions/upload-artifact@v3
# with:
# name: wrldbox-windows
# path: "*.exe"

5
MakefileMacOS Normal file
View File

@@ -0,0 +1,5 @@
gcc src/*.c -o wrldboxMacOS \
-I/opt/homebrew/include \
-L/opt/homebrew/lib \
-lraylib \
-framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo

View File

@@ -26,5 +26,4 @@ Clone the repository. Once you have navigated to the folder, you can run:
## 🏅Credits
This project was impossible without the support of all three `wholeworldcoding` members.
and Alex
This project was impossible without the support of all four `wholeworldcoding` members.

View File

@@ -2,59 +2,67 @@
#include <math.h>
#include "config.h"
#include "collision.h"
<<<<<<< HEAD
#include "player.h"
=======
>>>>>>> dff3a5d2c4b8cd3d6d86ab9792e394cd0d27a619
#include <stdio.h>
void checkCollision(){
float playerx=0.0;
float playery=0.0;
float plrsize=0.0;
for (int i = 0; i < MAX_ENTITIES; i++){
Entity *e = &entities[i];
if (!e->active)
continue;
if(e->isPlayer == false){
float objposx=e->position.x;
//float objposy=e->position.y;
float objsize=e->size;
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}
);
for(int u=0; u<=MAX_ENTITIES-1; u++){
Entity *en1 = &entities[u];
if(!en1->active){
continue;
}
en1->headgrounded = false;
for(int j=u+1; j<=MAX_ENTITIES-1; j++){
if(u!=j){
Entity *en2 = &entities[j];
if(!en2->active){
continue;
}
else{
ApplyForce(
player,
(Vector2){-(curhorvel*3), 1000}
);
printf("%d\n", en1->headgrounded);
float half = (en1->size + en2->size) * 0.5f;
float overlapX = half - fabsf(en1->position.x - en2->position.x);
float overlapY = half - fabsf(en1->position.y - en2->position.y);
if (overlapX > 0 && overlapY > 0)
{
if (overlapY < overlapX && en1->position.y < en2->position.y)
{
// top collision
en1->position.y = en2->position.y - half;
en1->velocity.y = 0;
en1->velocity.x *= en2->drag;
en1->headgrounded = true;
} else {
en1->headgrounded = false;
float forcex=fabsf(((en1->mass+en2->mass)/2)*((((en1->velocity.x)+(scale))+((en2->velocity.x)+(scale)))/2))*(scale*1.5);
float forcey=fabsf(((en1->mass+en2->mass)/2)*((((en1->velocity.y)+(scale))+((en2->velocity.y)+(scale)))/2))*(scale/4);
if(en1->position.x < en2->position.x){
en1->velocity.x=0;
en2->velocity.x=0;
ApplyForce(
en1,
(Vector2){-forcex, 0}
);
ApplyForce(
en2,
(Vector2){forcex, 0}
);
}
else{
en1->velocity.x=0;
en2->velocity.x=0;
ApplyForce(
en1,
(Vector2){forcex, 0}
);
ApplyForce(
en2,
(Vector2){-forcex, 0}
);
}
}
}
=======
(Vector2){1000, 1000}
);
ApplyForce(
player,
(Vector2){-1000, 1000}
);
>>>>>>> dff3a5d2c4b8cd3d6d86ab9792e394cd0d27a619
}
}
else{
playerx=e->position.x;
playery=e->position.y;
if(playery==playery)
plrsize=e->size;
}
}
}
}

View File

@@ -10,6 +10,7 @@ typedef struct Entity
bool isPlayer;
bool affectedByGravity;
bool headgrounded;
float mass;
float size;
@@ -20,6 +21,7 @@ typedef struct Entity
Vector2 force;
Color color;
float drag;
} Entity;

View File

@@ -59,7 +59,8 @@ int main(void)
GetRandomValue(50,255),
GetRandomValue(50,255),
255
});
},
GetRandomValue(0, 1) + 0.1f);
}
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
@@ -72,7 +73,8 @@ int main(void)
m.y,
25,
1.0f,
ORANGE);
ORANGE,
0.1f);
}
if (isSimulating)

View File

@@ -21,7 +21,7 @@ void UpdateEntities(float dt, int screenWidth)
bool onGround = IsGrounded(e);
// Apply gravity force if enabled for this entity
if (e->affectedByGravity)
if (e->affectedByGravity && !onGround)
{
ApplyForce(
e,

View File

@@ -7,10 +7,7 @@
// 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
@@ -23,10 +20,7 @@ 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;
}
@@ -38,10 +32,7 @@ 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,11 +3,6 @@
// FUNction declaration! yay!!!
// run by main.c constantly to allow player input.
<<<<<<< HEAD
extern bool dir;
extern float curhorvel;
=======
>>>>>>> dff3a5d2c4b8cd3d6d86ab9792e394cd0d27a619
void UpdatePlayerControls(void);
#endif

View File

@@ -1,5 +1,6 @@
#include <stddef.h>
#include "world.h"
#include "collision.h"
// the beeg one. hooooooooooooooooh boy
@@ -39,12 +40,12 @@ bool IsGrounded(Entity *e)
{
if (!e)
return false;
return (
e->position.y +
e->size * 0.5f >=
ground_y - 2.0f
);
if(e->position.y +e->size * 0.5f >=ground_y - 2.0f || e->headgrounded){
return true;
}
else{
return false;
}
}
Entity *SpawnEntity(
@@ -52,7 +53,8 @@ Entity *SpawnEntity(
float y,
float size,
float mass,
Color color)
Color color,
float drag)
{
for (int i = 0; i < MAX_ENTITIES; i++)
{
@@ -67,6 +69,7 @@ Entity *SpawnEntity(
e->mass = mass;
e->size = size;
e->drag = drag;
e->position = (Vector2){x, y};
e->velocity = (Vector2){0, 0};
@@ -74,6 +77,7 @@ Entity *SpawnEntity(
e->force = (Vector2){0, 0};
e->color = color;
e->headgrounded = false;
return e;
}
@@ -104,7 +108,8 @@ void InitWorld(void)
120,
40,
1.0f,
BLUE);
BLUE,
0.1f);
if (player)
{
@@ -118,7 +123,8 @@ void InitWorld(void)
50,
25,
1.0f,
RED);
RED,
0.9f);
}
simTime = 0.0f;

View File

@@ -12,10 +12,13 @@ extern bool isSimulating;
extern float simTime;
extern const float scale;
extern const float MAX_PLAYER_SPEED;
extern const float PLAYER_SPEED_FACTOR;
void ApplyForce(Entity *e, Vector2 force);
bool IsGrounded(Entity *e);
@@ -24,7 +27,8 @@ Entity *SpawnEntity(
float y,
float size,
float mass,
Color color);
Color color,
float drag);
void ClearWorld(void);
void InitWorld(void);

BIN
wrldbox

Binary file not shown.

BIN
wrldboxMacOS Executable file

Binary file not shown.