© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
1 reply
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(); }



}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ C# + raylib + freebsd
C#CC# / help
2y ago
✅ how does one setup raylib with c#
C#CC# / help
3mo ago
C# WPF: Creating 2D Graphics
C#CC# / help
2y ago
Simple 2D graphics in C#
C#CC# / help
3y ago