| View previous topic :: View next topic |
| Author |
Message |
NothingToShow Grandmaster Cheater Supreme
Reputation: 0
Joined: 11 Jul 2007 Posts: 1579
|
Posted: Mon Jan 14, 2008 1:34 pm Post subject: [Delphi] Jump Event - Game |
|
|
Hey.
I'm making a game at the moment, in Delphi, and my question is how to make a jump event.
You know any code for it?
- Møller
|
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Mon Jan 14, 2008 2:04 pm Post subject: |
|
|
Define "jump"...
if you mean Image1.Top := Image1.Top - 5 then don't even bother making a "game"...
|
|
| Back to top |
|
 |
NothingToShow Grandmaster Cheater Supreme
Reputation: 0
Joined: 11 Jul 2007 Posts: 1579
|
Posted: Mon Jan 14, 2008 2:05 pm Post subject: |
|
|
| A jump with gravity.
|
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Mon Jan 14, 2008 2:18 pm Post subject: |
|
|
This is not game maker here...
Do you mean moving a picture up and down or making a real game?
well, you can make your character jump untill X pixels (just store the starting point pixels and compare them to the current) but that would really suck..
if you want gravity, set your "gravity" lets say, to 5, lets say your character speed is 50 and weight 80 (a bronze helm and a metal sword with a shiny shild, thats a lot of stuff :O don't forget the 5 pokeballs holding 5 balbazores, however you spell) so make it jump at 50 speed, compare the gravity and weight and then choose when will it fall.
You can make your weight = milliseconds in air, or whatever...
|
|
| Back to top |
|
 |
NothingToShow Grandmaster Cheater Supreme
Reputation: 0
Joined: 11 Jul 2007 Posts: 1579
|
Posted: Mon Jan 14, 2008 2:33 pm Post subject: |
|
|
Well, I need code haha. That didnt really help me that much.
I'm trying to make a game, like the cool Slime Sport games.
I've made the jump stuff in Flash, but I cant figure out how to do it in Delphi.
|
|
| Back to top |
|
 |
rapion124 Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Mar 2007 Posts: 1095
|
Posted: Mon Jan 14, 2008 2:35 pm Post subject: |
|
|
| Delphi was never meant to make games. Try doing it in C#.
|
|
| Back to top |
|
 |
NothingToShow Grandmaster Cheater Supreme
Reputation: 0
Joined: 11 Jul 2007 Posts: 1579
|
Posted: Mon Jan 14, 2008 2:36 pm Post subject: |
|
|
| Screw it, I believe I can do it in Delphi.
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Mon Jan 14, 2008 3:10 pm Post subject: |
|
|
| rapion124 wrote: | | Delphi was never meant to make games. Try doing it in C#. |
Something tells me there isn't going to be some generic code snippet that you just plugin and it works...
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 474
Joined: 09 May 2003 Posts: 25956 Location: The netherlands
|
Posted: Mon Jan 14, 2008 7:43 pm Post subject: |
|
|
Ignore those remarks you can't make a game in delphi, you can as easily as in c++ . Of course, I'm not going to give you a easy copy/paste code you can use
in your render loop when drawing the character just let it move up or down.
Best add in a believable gravity algorithm to it.
So, each time the character is rendered look up the time and calculate at which position it should be and then render it at that position untill it hits something solid. (Of course, you'll have to program that check yourself, thus keep track of everything yourself)
also, if you don't feel like using directx or direct3d, the tpaintbox component in delphi has a 'decent' enough speed for 2d games (clear screen, draw current state of the game to a in memory bitmap and at the and draw the bitmap to the paintbox and repeat)
it's easier than setting up directX/direct3d, but it'll be a bit slower, and of course, doesn't contain routines to load in vertex buffers and buffer in textures for quick access
_________________
Tools give you results. Knowledge gives you control.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
NothingToShow Grandmaster Cheater Supreme
Reputation: 0
Joined: 11 Jul 2007 Posts: 1579
|
Posted: Tue Jan 15, 2008 5:51 am Post subject: |
|
|
Thank you very much Dark Byte.
I'll try to figure something out!
|
|
| Back to top |
|
 |
Snootae Grandmaster Cheater
Reputation: 0
Joined: 16 Dec 2006 Posts: 969 Location: --->
|
Posted: Wed Jan 16, 2008 9:35 am Post subject: |
|
|
if you wanted a sprite jumping around, you can easily do stuff like that
if you collide with the floor or a platform your jump variable = 1 and if not it = 0, you can only jump when it = 0, when you press the jump button your vertical speed increases and when your in the air you take a n amount every step from the vertical speed and, you have gravity! you have to make sure you cap your minimum negative vertical speed so it doesn't get ridiculous
not sure if collisions are easy to do or if they even work in delphi, im gonna go try
|
|
| Back to top |
|
 |
|