User Tools

Site Tools


lua:codea:stargenerator:main.lua
click
to support this page (eg 0,42 € or so) Thanks.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

lua:codea:stargenerator:main.lua [2013/01/24 04:01]
Wayne Michael created
lua:codea:stargenerator:main.lua [2013/01/24 04:03] (current)
Wayne Michael
Line 1: Line 1:
 +<code lua>
 +-- stars
 +function setup()   
 +    displayMode(FULLSCREEN)
 +    createstars()
 +    checkagain = false
 +end
  
 +function createstars()
 +    stars = {}
 +    for i = 1,175 do 
 +        --rx = math.random(1,1200)
 +       -- ry= math.random(1,800)
 +        s= Star(true)
 +        --u = { x=rx, y=ry}
 +      table.insert(stars,s)
 +    end   
 +    for i = 1,50 do 
 +        --rx = math.random(1,1200)
 +       -- ry= math.random(1,800)
 +        s= Star(false)
 +        --u = { x=rx, y=ry}
 +      table.insert(stars,s)
 +    end  
 +    
 +end
 +
 +-- This function gets called once every frame
 +function draw()
 +    -- This sets a dark background color 
 +    background(0, 0, 0, 255)
 +
 +
 +
 +     for a,b in pairs(stars) do
 +        b:draw()
 +     end 
 +     movestars()
 +
 +end
 +
 +function movestars()
 +    for b,s in pairs(stars) do
 +        s:move()
 +    end
 +end
 +
 +
 +</code>
advertising
lua/codea/stargenerator/main.lua.txt · Last modified: 2013/01/24 04:03 by Wayne Michael

Impressum