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.

72 lines
2.9 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
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. local function load_texture(filepath)
  2. local status, texture = pcall(am.texture2d, filepath)
  3. if status then
  4. return texture
  5. else
  6. return am.texture2d("res/bagel.jpg")
  7. end
  8. end
  9. TEXTURES = {
  10. -- note that in amulet, if you prefix paths with './', they fail to be found in the exported data.pak
  11. LOGO = load_texture("res/logo.png"),
  12. GEM1 = load_texture("res/gem1.png"),
  13. SHADED_HEX = load_texture("res/shaded_hex.png"),
  14. NEW_GAME_HEX = load_texture("res/newgamehex.png"),
  15. SAVE_GAME_HEX = load_texture("res/savegamehex.png"),
  16. LOAD_GAME_HEX = load_texture("res/loadgamehex.png"),
  17. SETTINGS_HEX = load_texture("res/settingshex.png"),
  18. MAP_EDITOR_HEX = load_texture("res/mapeditorhex.png"),
  19. ABOUT_HEX = load_texture("res/abouthex.png"),
  20. QUIT_HEX = load_texture("res/quithex.png"),
  21. UNPAUSE_HEX = load_texture("res/unpausehex.png"),
  22. CURTAIN = load_texture("res/curtain1.png"),
  23. -- gui stuff
  24. BUTTON1 = load_texture("res/button1.png"),
  25. WIDER_BUTTON1 = load_texture("res/wider_button1.png"),
  26. TAB_ICON = load_texture("res/tab_icon.png"),
  27. GUI_SLIDER = load_texture("res/slider.png"),
  28. GEAR = load_texture("res/gear.png"),
  29. SELECT_BOX = load_texture("res/select_box.png"),
  30. -- tower stuff
  31. TOWER_WALL = load_texture("res/tower_wall.png"),
  32. TOWER_WALL_ICON = load_texture("res/tower_wall_icon.png"),
  33. TOWER_HOWITZER = load_texture("res/tower_howitzer.png"),
  34. CANNON1 = load_texture("res/cannon1.png"),
  35. TOWER_HOWITZER_ICON = load_texture("res/tower_howitzer_icon.png"),
  36. TOWER_REDEYE = load_texture("res/tower_redeye.png"),
  37. TOWER_REDEYE_ICON = load_texture("res/tower_redeye_icon.png"),
  38. TOWER_MOAT = load_texture("res/tower_moat.png"),
  39. TOWER_MOAT_ICON = load_texture("res/tower_moat_icon.png"),
  40. TOWER_RADAR = load_texture("res/tower_radar.png"),
  41. TOWER_RADAR_ICON = load_texture("res/tower_radar_icon.png"),
  42. TOWER_LIGHTHOUSE = load_texture("res/tower_lighthouse.png"),
  43. TOWER_LIGHTHOUSE_ICON = load_texture("res/tower_lighthouse_icon.png"),
  44. HEX_FLOWER = load_texture("res/thing.png"),
  45. -- mob stuff
  46. MOB_BEEPER = load_texture("res/mob_beeper.png"),
  47. MOB_SPOODER = load_texture("res/mob_spooder.png"),
  48. }
  49. function pack_texture_into_sprite(texture, width, height, color)
  50. local sprite = am.sprite{
  51. texture = texture,
  52. s1 = 0, s2 = 1, t1 = 0, t2 = 1,
  53. x1 = 0, x2 = width, width = width,
  54. y1 = 0, y2 = height, height = height
  55. }
  56. sprite.color = color or vec4(1)
  57. return sprite
  58. end