Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / hot to simulate the gravity?

Author
Message
Adanf
16
Years of Service
User Offline
Joined: 22nd Sep 2008
Location: Italy!!!!!!!!!
Posted: 20th Oct 2008 19:19
How i can simulate the gravity in dark gdk?
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 20th Oct 2008 23:24
Easily. ypos-=gravity for 3D, += for 2D. Each frame, of course.
Adanf
16
Years of Service
User Offline
Joined: 22nd Sep 2008
Location: Italy!!!!!!!!!
Posted: 21st Oct 2008 00:28
Zuka, do you can post a code for simulate a 3d gravity pls?
i don't understand what you mean
thx
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 21st Oct 2008 00:28
Sorry, don't have time. >.>
SushiBox
16
Years of Service
User Offline
Joined: 20th Sep 2008
Location: Ohio
Posted: 21st Oct 2008 06:06
If you cant comprehend variables and simple math, I think you should study some more C++.

Also, the examples that come with DarkGDK address this problem in 2D and 3D.

www.Helios-Online.net
Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 21st Oct 2008 07:42
I recommend a C++ tutorial. You won't regret it. Here's page one:

http://www.cplusplus.com/doc/tutorial/program_structure.html

Windows Vista Home Premium Intel Pentium Dual-Core 1.6 Ghz 1GB DDR2 RAM GeForce 8600GT Twin Turbo
Adanf
16
Years of Service
User Offline
Joined: 22nd Sep 2008
Location: Italy!!!!!!!!!
Posted: 21st Oct 2008 18:31 Edited at: 21st Oct 2008 18:35
i know c++.
i don't understand what zuka's code do for my gravity question...
so i know that ypos-=gravity is ypos=ypos-gravity and that gravity and ypos are variables...
but what exactly do it for simulate the gravity?

pls someone help!

i need a code that simulate gravity thx
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 21st Oct 2008 23:38
It moves it down.
pcRaider
17
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 22nd Oct 2008 11:14 Edited at: 22nd Oct 2008 11:14
You write an equation.
And you write a code.

Attachments

Login to view attachments
Cole Xemi
16
Years of Service
User Offline
Joined: 20th Aug 2008
Location:
Posted: 23rd Oct 2008 03:18 Edited at: 5th Feb 2009 05:13
Demo of gravity: Look down

Deleted Post. For code look down.
Adanf
16
Years of Service
User Offline
Joined: 22nd Sep 2008
Location: Italy!!!!!!!!!
Posted: 23rd Oct 2008 17:48 Edited at: 23rd Oct 2008 18:34
Cole Xemi thanks for your code, this is what i'm searching for.

thx

p.s.: sorry Cole Xemi, but i don't use the command dbMoveSprite(),
but dbMoveObject() and the type of second variable of dbMove Object isn't the same of dbMoveSprite...
How can I modify it for a good result?
Cole Xemi
16
Years of Service
User Offline
Joined: 20th Aug 2008
Location:
Posted: 24th Oct 2008 02:06 Edited at: 5th Feb 2009 04:57
Deleted Post. For code look down.
Adanf
16
Years of Service
User Offline
Joined: 22nd Sep 2008
Location: Italy!!!!!!!!!
Posted: 29th Oct 2008 18:30
Quote: "I += 0.1; // Time

gravity.SetTime(I);"


but the Time variable is set to the screen refresh right?
Or Can i set it in seconds for a best work?
Cole Xemi
16
Years of Service
User Offline
Joined: 20th Aug 2008
Location:
Posted: 30th Oct 2008 05:00 Edited at: 30th Oct 2008 05:03
The variable Time represents an artificial counter. In real life time is constantly changing; we are just capturing it and using it!
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 30th Oct 2008 05:43
The main difference between game movement and real life movement - time.

In real life, you don't update everything each tick. In games, you do. But in real life, an object moves through each point of it's trajectory.
Adanf
16
Years of Service
User Offline
Joined: 22nd Sep 2008
Location: Italy!!!!!!!!!
Posted: 30th Oct 2008 18:25 Edited at: 30th Oct 2008 18:25
Ok, ^^ but the physics the sclae unit for rapresent the speed is in second, so for do the best work on a calculator is great a second-scale unit or a cicle tipe unit?
Noone have do that?

thx
Serengeor
15
Years of Service
User Offline
Joined: 17th Jan 2009
Location: Lithuania/lietuva
Posted: 4th Feb 2009 17:43
could you post a game with code of this? because i cant get it to compile

GDK Developer since now
Cole Xemi
16
Years of Service
User Offline
Joined: 20th Aug 2008
Location:
Posted: 4th Feb 2009 18:05
This is a demo I wrote a while ago showing off gravity.

http://forum.thegamecreators.com/?m=forum_view&t=136293&b=22
Serengeor
15
Years of Service
User Offline
Joined: 17th Jan 2009
Location: Lithuania/lietuva
Posted: 4th Feb 2009 21:37
Mhm i said with code i need sample code with collision + gravity and jump.
I already saw your game looks good.
Still waiting for sample code.

GDK Developer since now
Cole Xemi
16
Years of Service
User Offline
Joined: 20th Aug 2008
Location:
Posted: 5th Feb 2009 02:20 Edited at: 5th Feb 2009 05:11
I lost the source code of that build, but I hope this helps. The collision that I'm using is custom code writen by me, so it might be really irrelevant to you. The collision class below has been writen with my current game in mind, unlike the one used in the demo you saw.

Collision:


Gravity:


Main Loop:
Serengeor
15
Years of Service
User Offline
Joined: 17th Jan 2009
Location: Lithuania/lietuva
Posted: 5th Feb 2009 16:31
if only i could understand it .
I must go back to tutorials for c++ because i don't understand some things here

GDK Developer since now

Login to post a reply

Server time is: 2024-09-30 17:35:21
Your offset time is: 2024-09-30 17:35:21