0

I'm working on a game in monogame, one of the characters in the game is able to send out a rope from it's current location which will collide with terrain and allow them to swing across gaps.

The problem is that I don't even know where to begin on this sort of problem. I have a collision manager set up and entities. I just don't know what sort of steps should be taken to send out a rope and then to actually draw the rope as it moves.

As for actually causing the player to swing I was just going to use some circular momentum equations which I am familiar with.

Can anyone point me towards the sort of things I should be researching in order to get a rope that starts on the player and essentially stretches in a direction until it collides with terrain?

(No code since I'm not looking for a fix or definitive answer, just topic to research so I can get this done)

G

  • To add context, will the rope be physics enabled? You mention "stretching" so I assume so. A starting point, break down this problem into smaller problems and questions. First problem may be: Sending out the rope. If so, do you need to define a "rope projectile" class? Then, how do you create a physics-enabled rope? Two articles for your research: [Swinging Physics](http://gamedevelopment.tutsplus.com/tutorials/swinging-physics-for-player-movement-as-seen-in-spider-man-2-and-energy-hook--gamedev-8782) and [Creating a Rope](http://gamedev.stackexchange.com/questions/106136/how-to-create-rope) – Jonathon Ogden Apr 18 '16 at 11:24
  • The physics is something I am able to handle, since my strengths in programming lie within maths and physics based problems. I use the word stretching as I'm not sure how to describe it, the rope needs to start at the player and just extend itself in the direction specified. The reason it needs to extend itself is because we don't know how far away the platform it will collide with is. I'll take a look at the articles and return with more inforation – G Lewis Apr 18 '16 at 11:49
  • Taking a look at those articles, I think I can now explain my question better. If we ignore the idea of it being a rope. Instead of this, if we think of it as a rectangular entity on an angle (thus the Monogame rectangle class isn't useful) I need to create an entity that spawns on the player and the length of this rectangle increases until a collision happens, however as the length increases the width should not. – G Lewis Apr 18 '16 at 11:51
  • In essence, you're firing a line segment with no thickness in a particular direction. Ray casting, have you looked into that at all? It would allow you to determine the collision point and distance, two properties you will need to draw and extend the rope to its target. – Jonathon Ogden Apr 18 '16 at 12:03
  • Yes, essentially, once I have that I can work on creating a rope entity from it. I have started looking in to raycasting but can't find any useful resources, certainly not for monogame, I am currently continuing to go through the resources I have. Thank you so much for your help and have you any resources that can help me (preferably aimed at Monogame users)? Thanks again! – G Lewis Apr 18 '16 at 12:13
  • One more question to fill in some context, how does the player fire the laser? Do they pinpoint a target using the mouse cursor and it fires in the direction of the cursor? – Jonathon Ogden Apr 18 '16 at 12:23
  • Yes, it will be fired in the direction of the cursor (I have that working since the inputManager registers the location of the mouse and I have equations from previous projects for that) and will continue going in that direction until a collision is registered – G Lewis Apr 18 '16 at 14:39
  • Okay. I've had a glance at MonoGame's docs and broadly speaking, I'd consider firing a _projectile_ (could be a blank Sprite or empty Model) from the player in the direction of the cursor at a speed of your choice. You then have your start point (player location) and end point (projectile location) to _draw_ the rope between. If the rope is physics enabled, at certain intervals I assume you have to spawn joints to _build_ the rope? Otherwise, use a `Rectangle` with fixed height, where width is the distance between your start and end points then tile it (look into `TextureAddressMode.Wrap`) – Jonathon Ogden Apr 18 '16 at 18:27
  • Thank you very much for your help! I'll look into doing that immediately! – G Lewis Apr 19 '16 at 13:44

0 Answers0