Small Basic Forum

Full Version: Our solar system
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
DJTX452.000 is a simulation of our solar system. Who has suggestions for improvement?
Hello!  Smile

I like this.
When I was looking at the movement of the planets, I wanted to be able to place a "cosmic body" at any point on the screen.
I'm interested to see how this "body" will begin to move when the gravity of other planets begins to accelerate it.
The value of the mass of the "cosmic body" can be set in the settings (in the code).
The initial position of the "body" can be set by clicking the mouse on the screen.

Rolleyes
Hello.  Shy
It would also be interesting to avoid collisions with planets when you need to move from one planet to another using an interplanetary spaceship.  Rolleyes
You can add a background static star dome, sun and planet images - I'm sure you can find more online, but I already have uploaded from a space game I created (3DEarth, 3DJupiter and 3DMercury), image uploads : https://litdev.uk/game_images/upload.php

In a better code than below probably best to check if the files are already downloaded, so they only need to be downloaded once.  This is just a simple stub code.

Code:
view = LD3DView.AddView(GraphicsWindow.Width, GraphicsWindow.Height, "False")
LD3DView.MoveCamera(view, 0, 0, 0, -100)
LD3DView.AddAmbientLight(view, "Gray")
LD3DView.AutoControl("False","True",100,1)

skyDomeName = "3DStarDome.jpg"
skyDomeImage = Program.Directory+"/"+skyDomeName
skyDomeURL = "https://litdev.uk/game_images/uploads/"+skyDomeName
LDNetwork.DownloadFile(skyDomeImage,skyDomeURL)
skydome = LD3DView.AddSphere(view, 1000, 24, "Black","E")
LD3DView.AddImage(view, skydome, "", skyDomeImage,"E")
LD3DView.ReverseNormals(view,skydome)

sunName = "3Dsun.jpg"
sunImage = Program.Directory+"/"+sunName
sunURL = "https://litdev.uk/game_images/uploads/"+sunName
LDNetwork.DownloadFile(sunImage,sunURL)
sun = LD3DView.AddSphere(view, 10, 20, "Black", "E")
LD3DView.AddImage(view, sun, "", sunImage, "E")