hexyz is tower defense game, and a lua library for dealing with hexagonal grids
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.4 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. SOUNDS = {
  2. -- sfxr_synth seeds
  3. EXPLOSION1 = 49179102, -- this slowed sounds metal as fuck
  4. EXPLOSION2 = 19725402,
  5. EXPLOSION3 = 69338002,
  6. EXPLOSION4 = 92224102,
  7. COIN1 = 10262800,
  8. HIT1 = 39920504,
  9. LASER1 = 79859301,
  10. LASER2 = 86914201,
  11. PUSH1 = 30455908,
  12. SELECT1 = 76036806,
  13. PUSH2 = 57563308,
  14. BIRD1 = 50838307,
  15. BIRD2 = 16549407,
  16. RANDOM1 = 85363309,
  17. RANDOM2 = 15482409,
  18. RANDOM3 = 58658009,
  19. RANDOM4 = 89884209,
  20. RANDOM5 = 36680709,
  21. -- audio buffers
  22. MAIN_THEME = am.track(am.load_audio("res/ogg/main_theme.ogg"), true, 1, SETTINGS.music_volume)
  23. }
  24. CURRENT_TRACKS = {}
  25. function update_music_volume(volume)
  26. for _,track in pairs(CURRENT_TRACKS) do
  27. track.volume = math.clamp(volume, 0, 1)
  28. end
  29. end
  30. -- play sound effect with variable pitch
  31. function vplay_sfx(sound, pitch_range)
  32. local pitch = (math.random() + 0.5)/(pitch_range and 1/pitch_range or 2)
  33. win.scene:action(am.play(sound, false, pitch, SETTINGS.sfx_volume))
  34. end
  35. function play_sfx(sound)
  36. win.scene:action(am.play(sound, false, 1, SETTINGS.sfx_volume))
  37. end
  38. function stop_track()
  39. end
  40. function play_track(track, do_loop)
  41. table.insert(CURRENT_TRACKS, track)
  42. win.scene:action(am.play(track, do_loop or true))
  43. end