1
0
Fork 0
mirror of https://github.com/Oreolek/shooter.git synced 2024-04-25 21:49:21 +03:00
shooter/game/end.coffee
Alexander Yakovlev 3d68ca3bc9 Lots of fixes
- The game has been shortened
- The volume slider saves its value in a cookie
- Translation update
- No stats screen
2015-12-25 20:12:22 +07:00

60 lines
1.9 KiB
CoffeeScript

# This game does not *show* any qualities but it uses them.
# You can even resurrect the qualities block from the previous commits
# and it would work!
qualities
head:
bullets: qualities.integer("bullets".l()),
clips: qualities.integer("clips".l()),
enemies: qualities.integer("enemies".l()),
undum.game.init = (character, system) ->
system.setQuality("bullets", 6)
# Number of enemies. More enemies means the game will be longer.
system.setQuality("enemies", 21)
system.setQuality("clips", Math.floor(character.qualities.enemies / 6))
character.sandbox.search_clip_threshold = character.qualities.clips - 2
character.sandbox.clips = []
for i in [1 .. character.qualities.clips]
character.sandbox.clips.push(6)
character.sandbox.current_clip = 0
character.sandbox.nicked = 0
character.sandbox.seen_reload = 0
character.sandbox.seen_search = 0
character.sandbox.trick_shot = 0
character.sandbox.shots = 0
character.sandbox.reloads = 0
character.sandbox.killed = 0
character.sandbox.seen_pacifist = 0
character.sandbox.shot_pacifist = undefined
character.sandbox.steps = false
character.sandbox.steps_volume = 0
$("#title").click(() ->
$(".controls").fadeIn()
slider = $('#slider')
slider.slider({
range: "min",
min: 1,
value: 100,
slide: (event, ui) ->
value = slider.slider('value')
cookie.set('volume', value, { expires: '1D' })
volume = $('.voldisplay')
if value <= 5
volume.css('background-position', '0 0')
else if value <= 25
volume.css('background-position', '0 -25px')
else if value <= 75
volume.css('background-position', '0 -50px')
else
volume.css('background-position', '0 -75px')
})
slider.slider('value', cookie.get("volume"))
)
setInterval( () ->
play_steps(character)
, 2400 );
window.onload = undum.begin