Planet Game Idea (need help)

BlitzMax Forums/BlitzMax Beginners Area/Planet Game Idea (need help)

B(Posted 2011) [#1]
hey all,

back again with a new idea.

I want to create a simple demo for my idea and progress from there
into a game.

My idea is to have a small planet in the example colored brown and
a you are a person that can walk around the planets outside.

heres a picture to demonstrate:




i am having trouble with the setrotation() command.

I want the player to always be facing towards the center of the planet
and I do not know the formula to do this.

The arrow keys would control his movements, and using a distance formula i could keep the player at the surface of the planet, but
facing him towards the center is proving to be difficult for me.

Can anyone help me?

thanks! :)

heres my code so far


should run fine since i create the images inside the program


EDIT:
Im wondering if i should just rotate the planet and the things I plan on
putting on the planet underneath your character and have the character
stay in the same place.
What do you guys think?

Last edited 2011


Sloan(Posted 2011) [#2]
What about this?

SuperStrict
Graphics 800, 600

Local innerradius:Float = 92
Local radius:Float = 100
Local x:Float = 400
Local y:Float = 300
Local angle:Float = 0

While Not KeyHit(KEY_ESCAPE)
	
	If KeyDown(KEY_LEFT)
		angle:-2
		If angle < 0
			angle = angle + 360
		End If 		
	Else If KeyDown(KEY_RIGHT)
		angle:+2
		If angle > 360
			angle = angle - 360
		End If 
	End If 
	
	Cls
	
		Local rx:Float = Sin(angle) * radius
		Local ry:Float = Cos(angle) * radius
		
		SetColor 128, 192, 0
		DrawOval x - innerradius, y - innerradius, innerradius* 2, innerradius * 2
		 
		SetRotation angle 
		
		SetColor 255, 255, 255
		DrawRect x + rx, y - ry, 8, 8
		SetRotation 0
		
		DrawText "Angle: " + angle, 10, 10
			
	Flip
Wend 



It uses a little bit of trig to get the position of the square just right, and the same angle value is used in SetRotation to get it in the correct orientation.

Last edited 2011


B(Posted 2011) [#3]
wow! thats perfect!

i guess i should brush up on my trig, havent used it much since highschool.
haha!

thanks man! ill see what i can put together :)


Sloan(Posted 2011) [#4]
No problem :)


Kryzon(Posted 2011) [#5]
Might be fun to play with the sense of reference, related to when you're upside down. Your reference to what's "to the left" and what's "to the right" are reversed.

Try this (move the square toward the bottom of the sphere, release the arrow keys completely and then try to move again):


Last edited 2011


Sloan(Posted 2011) [#6]
Nice touch, Kryzon! Feels a bit weird to begin with-- to get your head around the fact your on the southern hemisphere. Kinda like "playing with portals" :)


andy_mc(Posted 2011) [#7]
It's Mario Galaxy 2D!!! Will the player be able to jump onto new planets? This reminds me of the british gas adverts.


B(Posted 2011) [#8]
hey guys

so here is what came about.

its not nearly finished, not really fun to play for a long time
but still pretty cool and innovative...i think.



oh ya and space to collect wood from trees



pretty random i know,

but tell me what you think.

:)

Last edited 2011


Sloan(Posted 2011) [#9]
Liking it so far :)