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.

2D All the way! / another gravity question

Author
Message
HowDo
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 8th Jan 2006 13:45
Hi ALL,

done the search but not found what am looking for, or I don't understand the code if it is there.

Ok the question, I have my space ship sprite that I wish it to land on the moon.

imageposy=imageposy+(shipmass*moongravity)-backdroprateofpower.thrust
this just make it go up insted of down.

Now I know that the top of the screen is y=0. I am keeping my sprite ship still at screen center, have put my lunar land on to a plain object and are trying to get this object to move up the screen so that it looks like the ship is landing.

can get it to work if I use

imageposy=imageposy+1.0-backdroprateofpower.thrust

but that just stay at a constant rate of fall no speed up

can post code but will take time to make simple sample sprites and backdrop.

I'm not getting you down am I, Ho Look! another fancy Door?
Zergei
21
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 8th Jan 2006 19:42
Try using real numbers instead of integers because integers don't save numbers after the dot "." , so 5 / 2 = 2 with an integer.
I think the problem may be with moongravity or shipmass or both. You increase the in (let's say) 0.2 , but being integers will stay in 0 (or whatever number it was). Try it out...
HowDo
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 9th Jan 2006 12:35 Edited at: 9th Jan 2006 13:13
will check on that, they should be ok as I have set them as a #constant but might have left the As bit off the end.

using the moongravity wrong, kept staying at zero.

Now have a new problem, I am adding

gravity = (gravity + moongravity )-(backdroprateofpower.thrust/100)

This now allows me to fire the thurster and I can now go back up, but how would I make the gravity get less if that what would happen if I fire the thrusters.

At the moment even with thruster on full the gravity keeps on going up by 0.6.

I'm not getting you down am I, Ho Look! another fancy Door?
Zergei
21
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 11th Jan 2006 04:08
Well, why don't you adjust moongravity accordingly to the distance between the spaceship and the moon... when near the moon, te gravity would be stronger, when far away from it , it would be weaker or unexistent...
HowDo
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 11th Jan 2006 05:21
I think I worked out what might be wrong, scale, my world does not fit the real world, when I am saying that a 2000 pixles is the same as 2000 feet.
sort of means that on screen a pixle is 1 foot long, no work, so I will have to scale gravity to fit my world.

I'm not getting you down am I, Ho Look! another fancy Door?
Grace
20
Years of Service
User Offline
Joined: 8th Feb 2006
Location: traveling
Posted: 18th Feb 2006 03:20
Quote: "
imageposy=imageposy+(shipmass*moongravity)-backdroprateofpower.thrust
"

I think you have to add the backdroprateofpower.thrust since in 2D adding is going down.

Email me at [email protected] or visit me at www.geocities.com/grace9great/index.html
Dave1974
21
Years of Service
User Offline
Joined: 1st Aug 2004
Location:
Posted: 7th Apr 2006 14:45
HowDo

I would add another variable to hold the speed the ship travels at.



you would need to cap the fallrate at a sensible amount.
HowDo
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 7th Apr 2006 23:43
Dave1974 thanks for your time of going through the above, will dig it out and give it a try.

I'm not getting you down am I, Ho Look! another fancy Door?

Login to post a reply

Server time is: 2026-07-02 03:30:01
Your offset time is: 2026-07-02 03:30:01