C
C#14mo ago
peck

❔ raylib c# 2d collison

my code is this when ever i go on the or bottom is slides off and when i go to the right on it theres likea pixel gap is there any examples of collision sorry i done it rlly wrong
c#
if(CheckCollisionRecs(p.rec, t.rec) && t.col)

{

if(p.rec.x >= t.rec.x) { p.rec.x += p.speed * GetFrameTime(); }

if(p.rec.x <= t.rec.x) { p.rec.x -= p.speed * GetFrameTime(); }

if (p.rec.y >= t.rec.x) { p.rec.y += p.speed * GetFrameTime(); }

if (p.rec.y <= t.rec.x) { p.rec.y -= p.speed * GetFrameTime(); }



}
c#
if(CheckCollisionRecs(p.rec, t.rec) && t.col)

{

if(p.rec.x >= t.rec.x) { p.rec.x += p.speed * GetFrameTime(); }

if(p.rec.x <= t.rec.x) { p.rec.x -= p.speed * GetFrameTime(); }

if (p.rec.y >= t.rec.x) { p.rec.y += p.speed * GetFrameTime(); }

if (p.rec.y <= t.rec.x) { p.rec.y -= p.speed * GetFrameTime(); }



}
1 Reply
Accord
Accord14mo ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server