The Daily Click ::. Forums ::. Klik Coding Help ::. Isometric Variable Length Jumping - HELP!
 

Post Reply  Post Oekaki 
 

Posted By Message

SoldjahBoy



Registered
  25/10/2006
Points
  100
1st November, 2006 at 10:07:36 -

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?

Thanks in advance if anyone can help!

-Sol

 
What's wrong with pillow shading? O.o

SoldjahBoy



Registered
  25/10/2006
Points
  100
1st November, 2006 at 23:11:01 -

Wow no takers?

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.

http://i2.photobucket.com/albums/y46/soldjahboy/AIKO_White_PVC.jpg

http://i2.photobucket.com/albums/y46/soldjahboy/CO-Trojan-coloured.jpg

http://i2.photobucket.com/albums/y46/soldjahboy/zbrush7.jpg

http://i2.photobucket.com/albums/y46/soldjahboy/techno-flyer-2.jpg

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...

So, any takers now?

 
What's wrong with pillow shading? O.o

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
2nd November, 2006 at 00:54:31 -

gotta give it some time man. Give it a few days.

 
Craps, I'm an old man!

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
2nd November, 2006 at 04:32:37 -

I guess you're used to overcrowded communities with one post every minute, but this place is a lot more quiet than that.

I can do jumping, I can also do jumping in an arc, but variable height jumping is where I go wrong myself. Sorry, can't help.

 
Old member (~2004-2007).

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
2nd November, 2006 at 08:18:04 -

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.

Image Edited by the Author.

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
2nd November, 2006 at 09:09:24 -

The actual height need only be a factor of the distance, I suppose. Can't see where fancy maths would come into it.

 
n/a

SoldjahBoy



Registered
  25/10/2006
Points
  100
2nd November, 2006 at 09:20:51 -

@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.

 
What's wrong with pillow shading? O.o

SoldjahBoy



Registered
  25/10/2006
Points
  100
2nd November, 2006 at 11:52:31 -

Sorry for the double post again...

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.

-Sol

Image Edited by the Author.

Image Edited by the Author.

 
What's wrong with pillow shading? O.o

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
2nd November, 2006 at 12:14:45 -

change the speed of the jump depending on the length? or change the Set alterable Value A from 10 to a percentage of the jump length?

To find the jump length, use the formula distance = square root((X1 - X2)² + (Y1-Y2)²)
where X1 is the start x co-ordinate, x2 is the end, etc

The longer the jump, the quicker/higher he jumps, and the shorter the jump, the slower/lower he jumps?

Maybe.

 
My signature is never too big!!!

SoldjahBoy



Registered
  25/10/2006
Points
  100
2nd November, 2006 at 12:17:29 -

Awsome Joe

I'll give it a shot after work tomorrow.... its nearly 4am and my eyes are burning lol. I'll let you know how I go with it!

Those were the "fancy mathematics" I was talking about

-Sol

 
What's wrong with pillow shading? O.o

SoldjahBoy



Registered
  25/10/2006
Points
  100
3rd November, 2006 at 13:47:34 -

Joe,

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

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
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.

 
Old member (~2004-2007).

SoldjahBoy



Registered
  25/10/2006
Points
  100
4th November, 2006 at 08:13:45 -

distance = square root((X1 - X2)² + (Y1-Y2)²)

Im having trouble setting the equasion. Square Root is obviously "Sqr" but how do I do the squared command (IE the "²")?

I can't seem to find in the calculator the right thing to insert... I tried putting a ² in there but it returns a syntax error.

Thanks again

-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

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
4th November, 2006 at 09:50:34 -

sqr((X1 - X2) pow 2 + (Y1-Y2) pow 2) I believe.

 
Old member (~2004-2007).

SoldjahBoy



Registered
  25/10/2006
Points
  100
4th November, 2006 at 11:10:43 -

Ah yes, pow... I was wondering what that was for lol.

Thanks again DaVince, I'll try that

 
What's wrong with pillow shading? O.o
   

Post Reply



 



Advertisement

Worth A Click