C#C
C#3y 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(); }



}
Was this page helpful?