ScreenEntities.lua 772 B

12345678910111213141516171819202122232425262728
  1. screen = Screen()
  2. sun = ScreenShape(SHAPE_CIRCLE, 100,100, 30)
  3. sun:setPosition(640/2, 480/2)
  4. sun:setColor(1.0, 0.0, 0, 1)
  5. sun.colorAffectsChildren = false
  6. screen:addChild(sun)
  7. planet = ScreenShape(SHAPE_CIRCLE, 50,50, 30)
  8. planet:setPosition(150,0)
  9. planet:setColor(0.2, 0.8, 0, 1)
  10. planet.colorAffectsChildren = false
  11. sun:addChild(planet)
  12. moon = ScreenShape(SHAPE_CIRCLE, 20,20, 30)
  13. moon:setPosition(50,0)
  14. moon:setColor(1, 1, 0.6, 1)
  15. planet:addChild(moon)
  16. planetRotation = 0
  17. moonRotation = 0
  18. function Update(elapsed)
  19. planetRotation = planetRotation + elapsed
  20. moonRotation = moonRotation + (elapsed * 6)
  21. planet:setPosition(cos(planetRotation)*150, sin(planetRotation)*150)
  22. moon:setPosition(cos(moonRotation)*50, sin(moonRotation)*50)
  23. end