Start wandering the entire playground and your only goal is to reach the food.
Control the baby snake to eat it in Play Snake game. This calculation is also often used in path finding, like A* to check how far something went in one direction.In Play Snake game where you will start as a baby snake, if everything goes well, you will become a giant snake. Note: it can move diagonal here, I wanted to keep it simple. Private float GridDistance(Vector3 PointA, Vector3 PointB)įloat xd = Mathf.Abs(PointA.x - PointB.x) įloat xz = Mathf.Abs(PointA.z - PointB.z) Vector3 Velocity = MoveDirection * Speed * ltaTime TargetPoint = PositionOnGrid + MoveDirection Vector3 PositionOnGrid = new Vector3(Mathf.Round(), 0, Mathf.Round()) InputDirection = new Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical")) If (GridDistance(transform.position, TargetPoint) > 0.5f) It can only get input when it has moved beyond the half way So a Unity version would look like this: public class SnakeInput : MonoBehaviourĭebug.Log(GridDistance(transform.position, TargetPoint)) Instead a simple distance calculation was use, the problem is that it is directional some games exploited this nature. In the old days they didn't do distance calculations because it was expensive.
The trick is with the code checking distance, before taking the input. Or are they just snapping all the way and using MoveToward() functions to get the image to catchup?īut I was referring to the fact you get instant "seeming" response regardless of whether you tap early or late or right-on-time. How can we get instant response from early turns too? I mean without forcing the entire tail to play instant catchup? Input at either of the following markers seem like they cause problems when you want both smooth-snake movement and instant response like the Google game: If we go back to the drawing board, a late-turn should NOT feel smooth, considering this is what's happening: Tapping early still feels instant, but you can see the snake animating to reach the center and turn, how on earth does this still feel instant? Tapping late seems to snap, though it's hard to observe. Google's Snake is smooth, and it seems as though you get an INSTANT response from the snake regardless of whether you tap early or late. one way or another there is a 0-1 window for input per-square. Google's Snake game has very instant response time and it's baffling me. Check out our Discord! Suggestions and feedback Message the Moderators r/Games: A place for informative and interesting gaming content and discussions. r/gamedevclassifieds: A game development classified section to help you find talent, or to help the talent find you. r/indiegaming: The place for all news and developments in the Indie gaming community. r/themakingofgames: For all 'behind the scenes' content of your favorite games. r/devblogs: The latest blog posts from your favorite game development bloggers. r/GameSociety: reddit's "book club" for games. r/ludology: For the serious discussion and analysis of games played on a computer, board, field or any other interactive media. r/tabletopgamedesign: All things related to designing tabletop RPGs, wargames, board, and card games. r/gamedev: All things related to game development, programming, math, art, music, collaboration. If your post isn't related to game rule crafting, consider posting in one of the following subreddits: Please report any submissions or comments violating these rules using the report button. Show-off posts are only allowed as game design case studies (Tell us how/ why you developed an interesting game design concept in your game)ģ) DO NOT link to an article or video without providing a short summary. All submissions must be related to Game Design.Ģ) DO NOT post self-promotion, sales, low-effort posts, memes, jokes, etc. "how do I fix this problem in Unity?" or "how do I get a job in the game industry?" Try /r/gamedev instead. Posting rulesġ) DO NOT post about general Game Development, e.g. If you're new to /r/GameDesign, please read the GameDesign wiki for useful resources and an FAQ. Game Designers of all experience levels are welcome! Posts about visual art, sound design and level design are only allowed if they are also related to game design. Posts about programming, making assets, picking engines etc… will be removed and should go in /r/gamedev instead. This is NOT a place for discussing how games are produced. If you're confused about what game designers do, "The Door Problem" by Liz England is a short article worth reading. It's about the theory and crafting of mechanics and rulesets. Game Design is a subset of Game Development that concerns itself with WHY games are made the way they are.