Game programming tile collision




















Then execute a "bump" see below. All ships that are turning but have not "stopped entirely" then attempt to claim their destination space. Now that space also has five possibilities: 2. Example So let's say you select the forward move on your ship, and there is another ship on the target tile you are aiming to forward.

So my question is, how can this be done, in the proper way? Improve this question. Ben Beri Ben Beri 55 8 8 bronze badges. What particular difficulty have you encountered in implementing these rules in your game?

I just want to see if there are more ideas to do this even better. It's trivial. Show 1 more comment. Active Oldest Votes. MoveTo proposedPosition ; tiles[proposedPosition. Turn move. Ship; if tiles[position. Improve this answer. Engineer Engineer 29k 4 4 gold badges 67 67 silver badges bronze badges. I'm working, now, and will be for the next few days. Add a comment. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.

The Overflow Blog. Stack Gives Back Safety in numbers: crowdsourcing data on nefarious IP addresses. Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Related 5. Hot Network Questions. Question feed. Accept all cookies Customize settings. Careers Careers. Learn about game development.

Follow Us. Chat in the GameDev. Back to General and Gameplay Programming. Tile Map Collision. General and Gameplay Programming Programming. Started by krrice January 06, PM. Any info will be appriciated. Cancel Save. Aeramor KnolanCross Wouldn't that work? Here is Player. This topic is closed to new replies. Josheir Remember me. Forgot password? Don't have a GameDev. Sign up. Email Address. Careers Careers.

Learn about game development. Follow Us. Chat in the GameDev. Back to General and Gameplay Programming. General and Gameplay Programming Programming. Started by Xanather October 21, AM. Xanather I have been seriously trying at this for just about a day now. Such as simple thing is creating big problems.

I am trying to implement 2D tile based collision. All have failed. Should I create a algorithm that calculates the velocity to apply to the position the velocity calculated by the algorithm will insure that the non-static moving entity will not hit solid tiles or create a algorithm that calculates the position of the entity after the velocity has been applied to it resulting in directly changing the position to ensure that it will not collide with another tile.

All in all this is a generic question, how can this be done properly? A real example of what I want to do is terraria's character movement. All replies are appriciated. Thanks, Xanather. Edit 2: Entities have the same axis scale as the tiles 1, 1 would mean the player would be drawn at 16, 16 on the screen.

X, position. X, y].



0コメント

  • 1000 / 1000