Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Game start
- tweens.bullet_y = 180
- var_s_bullet_x = 0
- var_zone = 15
- var_s_target_a_x = math.random(-200,200)
- var_s_target_a_y = math.random(-200,200)
- function ship_pos()
- var_ms_ship_x_pos = wm_tag(-{sax})*19
- end
- function bullet()
- wm_schedule {
- { action='tween', tween='bullet_y', from=180, to=-250, duration=1, easing=linear },
- }
- end
- var_ms_score = 0
- function on_millisecond(dt)
- ship_pos()
- if (var_s_target_a_x >= (var_ms_ship_x_pos - var_zone) and var_s_target_a_x <= (var_ms_ship_x_pos + var_zone)) then
- var_ms_x_hit = 1
- else
- var_ms_x_hit = 0
- end
- if (var_s_target_a_y >= (tweens.bullet_y - var_zone) and var_s_target_a_y <= (tweens.bullet_y + var_zone)) then
- var_ms_y_hit = 1
- else
- var_ms_y_hit = 0
- end
- if (var_ms_x_hit == 1 and var_ms_y_hit == 1) then
- var_ms_score = var_ms_score + 1
- wm_vibrate(1,30)
- bullet()
- end
- if (var_s_target_a_x >= (var_ms_ship_x_pos - var_zone) and var_s_target_a_x <= (var_ms_ship_x_pos + var_zone) and var_s_target_a_y > 160 ) then
- var_ms_score = var_ms_score - 5
- wm_vibrate(1,50)
- end
- end
- function on_second(h,m,s)
- if s%3==0 then
- var_s_target_a_x = math.random(-200,200)
- var_s_target_a_y = math.random(-200,200)
- end
- var_s_bullet_x = var_ms_ship_x_pos
- bullet()
- end
- function on_display_bright()
- var_ms_score = 0
- end
- var_highscore = 0
- function on_display_not_bright()
- if var_ms_score > var_highscore then
- var_highscore = var_ms_score
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement