SÖLAR, a fairly simple solar system simulator
SÖLAR, a fairly simple solar system simulator
New and planned features shown in the app itself in the help pannel.
DOWNLOAD IT HERE:
(direct link to .love attachments)
Version 0.91
Screenshot here
download/file.php?mode=view&id=6152
Additional credits to:
Saegor: realtime stars algorithm
More to come.
Enjoy.
- Attachments
-
- solar.love
- 0.91
- (42.04 KiB) Downloaded 666 times
Last edited by Ubermann on Thu Nov 22, 2012 4:39 pm, edited 4 times in total.
Re: SÖLAR, a fairly simple solar system simulator
Cool.Saegor wrote:nice !
i wrote a bit of code for your stars (if you want)
EDIT : new code
etc etc etc
I added it to the my original code.
I gave the option to switch between three background modes: "black background", "static image background" and "realtime stars background", because for slow or old computers your realtime stars may cause slowdows, so the "player" can choose which mode to use.
Also I changed the "hide orbit lines" to "change orbit lines translucency".
blah blah blah read down.
Re: SÖLAR, a fairly simple solar system simulator
Tweaked version released with:
- Saegon realtime stars, rotating static starfield and all-black background
- Some GUI changes
- Added help pannel and simple app logo
- Some serious code changes
- Initial implementation of mouse support
- Tooltips when hovering mouse over any plater (more planet info will come ofc)
- Some slightly speed improvements
- Maybe something else I can't remember now.
Details in 1st post.
- Saegon realtime stars, rotating static starfield and all-black background
- Some GUI changes
- Added help pannel and simple app logo
- Some serious code changes
- Initial implementation of mouse support
- Tooltips when hovering mouse over any plater (more planet info will come ofc)
- Some slightly speed improvements
- Maybe something else I can't remember now.
Details in 1st post.
Re: SÖLAR, a fairly simple solar system simulator
New version of Sölar space background.
Changelog :
- important changes codewise : now 3 files (main.lua, stars.lua, comets.lua)
main.lua
stars.lua
comets.lua
press tab or space to see a comet
Changelog :
- important changes codewise : now 3 files (main.lua, stars.lua, comets.lua)
main.lua
Code: Select all
function love.load()
gr = love.graphics
getW = gr.getWidth()
getH = gr.getHeight()
require "stars"
require "comets"
end
function love.update(dt)
stars:update()
if comet.e then comet:update(dt) end
end
function love.draw()
stars:draw()
if comet.e then comet:draw() end
end
function love.keypressed(key)
if key == "escape"
or key == "return" then
love.event.push("quit")
end
if key == "tab"
or key == " " then
comet:new()
end
end
Code: Select all
stars = {}
for i = 1, 0x400 do
stars[i] = {}
stars[i].x, stars[i].y, stars[i].n =
math.random(0, getW),
math.random(0, getH),
math.random(0, 0xff)
end
function stars:update(dt)
for k, _ in ipairs(self) do
local m = math.random(-0x08, 0x08)
self[k].n = self[k].n + m
if self[k].n < 0x10 then
self[k].n = 0x10
elseif self[k].n > 0xff then
self[k].n = 0xff
end
end
end
function stars:draw()
for k, _ in ipairs(self) do
local c = self[k].n
gr.setColor(0xff, 0xff, 0xff, c)
gr.point(self[k].x, self[k].y)
end
end
Code: Select all
comet = {}
for i = -10, 10, 4 do
table.insert(comet, i)
end
function comet:new()
self.e = true
self.dx = self[math.random(#self)]
self.dy = self[math.random(#self)]
if math.random(2) > 1 then
self.x = getW/2 - self.dx/math.abs(self.dx) * getW/2
self.y = math.random(0, getH)
else
self.x = math.random(0, getW)
self.y = getH/2 - self.dy/math.abs(self.dy) * getH/2
end
end
function comet:update(dt)
self.x = self.x + self.dx * dt * 0x40
self.y = self.y + self.dy * dt * 0x40
if self.x < - getW or self.x > getW * 2
or self.y < - getW or self.y > getH * 2 then
self.e = nil
end
end
function comet:draw()
for i = 16, 1, -1 do
local c = 0x80/i
gr.setColor(0xff, 0xff, 0xff, c)
gr.line(
self.x, self.y,
self.x - i * self.dx, self.y - i * self.dy
)
end
end
Last edited by Saegor on Mon Nov 26, 2012 6:00 pm, edited 11 times in total.
Current work : Isömap
Re: SÖLAR, a fairly simple solar system simulator
looks quite nice, actually.
Lua is not an acronym.
Who is online
Users browsing this forum: Google [Bot] and 4 guests