© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•12mo ago•
29 replies
Theos

Calculate if jump is possible

Hey, I'm working on a 2D grid game (think Terraria), I want to check if a monster can make jump from point A (start) to B (target). It can adjust its horizontal/vertical speed to hit smaller/bigger jumps, same as the player can (for example by holding space for longer to jump higher).
So I'm calling this function
 CanMakeJump(monster.gridPos, target.gridPos, maxJumpPower, someGravityValue)
 CanMakeJump(monster.gridPos, target.gridPos, maxJumpPower, someGravityValue)

I have no clue if my formula is even right, I'm getting weird results partially because I don't know how to incorporate horizontal velocity which should be based on monster's
movementSpeed
movementSpeed
statistic.

Code: https://pastebin.com/7WT8ULBS
Pastebin
```csprivate float CanMakeJump(Vector2Int start, Vector2Int target,...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
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

❔ Calculate Area
C#CC# / help
4y ago
Workshop calculate not working
C#CC# / help
12mo ago
c# calculate a discount
C#CC# / help
3y ago