First off, I'd like to thank everyone that offered solution(s) to my last problem. THANKS!
Now to get down to it... The game I am making is isometric, and while this isn't exactly my FIRST isometric game attempt, it IS the most complex I have attempted.
To give you a rough idea of how the game controls will work will help me explain my acctual problem to you:
The mouse will be used to drive a cursor like in the old adventure games (Monkey Island etc), where clicking will make the character walk to the designated position. This is easy to do as you all know, and so far the control technique I have used is working fine... however...
A feature I would like to implement is jumping, but not just any ordinary jump... Jumping will be variable length. For example, the character is at position A on the screen, and the mouse cursor is at position B on the screen... the user holds CTRL and clicks the mouse (rather than just clicking normally to initiate a walking sequence) and the player will leap from position A to position B in a nice arcing fashion.
I know that this requrires some fancy mathematics, and unfortunately math was not my best subject at school. I'm a visual type... numbers mean little to me until I can see the direct effect on my characters/objects by modifying them.
If anyone is willing to assist me with some math formulae, or make an example file using some simple crappy graphics just so I can get the idea of how it would work... I would be most in debted to you, and more than happy to return the favour with some graphics work perhaps?
I suppose it's a bit of an empty thing to say when I offer my graphics skils in return for some coding help... so here are a few links to some of my artwork. My sprite work follows the same quality.
I mostly make stuff in 3D when making sprites because of the endless amount of animation frames that can be pumped out without having to pain-stakingly draw them one by one...
Shouldn't be too hard. You just create an invisible object that walks directly to the designated point. Then you just position the real player relatively to the invisible object. Like...
* (Jump event)
- Real player: Set value A to -10
* Always
- Real player: Add 1 to value A
- Real player: Set X position to X of invisible object
- Real player: Set Y position to Y of invisible object + value A of real player
* Value A of real player > 0
- Real player: Set value A to 0
Or something like that. I can make an example later, maybe.
@Knuddle - Yeah I suppose so... just thought someone would have said something in the first 15 hours or so :/
@DaVince - Same as above and, the jumping wouldn't be variable height, just variable length. The height would always be the same.
@Axel - OK thanks, I'll mess around with that but I have a feeling to get it to work properly it would need a calculation of the distance between the coordinates or the characters position and the landing spot?
@Radix - I'm pretty sure to get it to work properly for any distance on any angle between any two sets of coordinates, sin and cos would need to be used to work out the arc. I could be wrong, and probably am... that's why I am asking for help.
Thanks so far guys. I know it's a lot of work to help people out, especially when you have your own projects to consider. I appreciate any comments and assistance.
Axel gave me something to work with and I seem to be having some fairly good luck with it. I have, of course, tweaked the code example he gave me and it seems to create a fairly realistic jump effect. I had to add a section of code that would slowly modify the A value of the player object so they wouldn't just "appear" at the peak of the jump, but rather start on the ground and accelerate upwards until the peak, then slowly fall back down.
The only problem with this is that, it only works optimally when the jump distance is right. If the jump is too short, the character gets to the destination and hovers over the ground and slowly falls... if the jump is too long then the character lands prematurely and "slides" along the ground.
Any further hints/ideas you can drop me to deal with the variable distance would be awsome. I'm thinking I need to figure out the distance (as previoulsy stated) between the starting position and the landing destination, and use that value somehow in the "jumping" equasion.
Thanks again in advance! Oh, and... sorry I'm asking so many questions. I should know all this stuff already since I've been making klick games for so long, but I've never tried anything like this particular idea.
I've looked at, and understood the forumla you have most gratefully given me, however I don't fully understand exactly where it should be used?
Once I have the distance, should that become the speed of the character? Seeing as the peak of the jump should occur at 50% of the distance formula sum?
I'm a little confused by the [i]application[/i] of the formula, rather than the forumla itself...
-Sol
What's wrong with pillow shading? O.o
DaVince This fool just HAD to have a custom rating
Registered 04/09/2004
Points 7998
3rd November, 2006 at 16:42:29 -
The formula just shows how you can get the distance between two points. You could then use that knowledge to change the max jump height according to this distance.