mirror of
https://github.com/elua/elua.git
synced 2025-01-25 01:02:54 +08:00
Randomize seed on start now depends on user time delay
Longer screen power off delay at the end
This commit is contained in:
parent
a66a9fed6d
commit
2812e9eef3
@ -243,10 +243,9 @@ upload_items()
|
|||||||
lm3s.disp.init( 1000000 )
|
lm3s.disp.init( 1000000 )
|
||||||
|
|
||||||
tmr.start( tmr_id )
|
tmr.start( tmr_id )
|
||||||
--menu()
|
lm3s.disp.print( "Pls press SELECT -->", 0, 34, 12 )
|
||||||
math.randomseed( tmr.read( tmr_id ) ) -- If you use the menu function, the time will be used as a seed to the random function
|
while not kit.btn_pressed( kit.BTN_SELECT ) do end -- Random init delay to randomsee
|
||||||
--tmr.stop( tmr_id )
|
math.randomseed( tmr.read( tmr_id ) )
|
||||||
|
|
||||||
collectgarbage( "collect" )
|
collectgarbage( "collect" )
|
||||||
|
|
||||||
-- GAME START
|
-- GAME START
|
||||||
@ -272,6 +271,7 @@ repeat
|
|||||||
draw_wall( canvas.x )
|
draw_wall( canvas.x )
|
||||||
draw_paddle( paddle.y, 11, 0 )
|
draw_paddle( paddle.y, 11, 0 )
|
||||||
|
|
||||||
|
local stop_playing = true
|
||||||
while ( true ) do
|
while ( true ) do
|
||||||
for i = 0, 1 do
|
for i = 0, 1 do
|
||||||
update_paddle_pos()
|
update_paddle_pos()
|
||||||
@ -316,14 +316,12 @@ repeat
|
|||||||
lm3s.disp.print( "Your score was "..tostring( score ), 15, 40, 11 )
|
lm3s.disp.print( "Your score was "..tostring( score ), 15, 40, 11 )
|
||||||
lm3s.disp.print( "Highscore: "..tostring( highscore ), 15, 50, 11 )
|
lm3s.disp.print( "Highscore: "..tostring( highscore ), 15, 50, 11 )
|
||||||
lm3s.disp.print( "SELECT to restart", 6, 70, 11 )
|
lm3s.disp.print( "SELECT to restart", 6, 70, 11 )
|
||||||
enough = true
|
for i=1, 1000000 do
|
||||||
for i=1, 100000 do
|
|
||||||
if kit.btn_pressed( kit.BTN_SELECT ) then
|
if kit.btn_pressed( kit.BTN_SELECT ) then
|
||||||
enough = false
|
stop_playing = false
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
until ( enough )
|
until (stop_playing)
|
||||||
|
|
||||||
lm3s.disp.off()
|
lm3s.disp.off()
|
||||||
lm3s.disp.init( 1000000 )
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user