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.

56 lines
2.0 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
  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. LOGO = load_texture("res/logo.png"),
  11. GEM1 = load_texture("res/gem1.png"),
  12. -- gui stuff
  13. BUTTON1 = load_texture("res/button1.png"),
  14. WIDER_BUTTON1 = load_texture("res/wider_button1.png"),
  15. TAB_ICON = load_texture("res/tab_icon.png"),
  16. GUI_SLIDER = load_texture("res/slider.png"),
  17. -- tower stuff
  18. TOWER_WALL = load_texture("res/tower_wall.png"),
  19. TOWER_WALL_ICON = load_texture("res/tower_wall_icon.png"),
  20. TOWER_HOWITZER = load_texture("res/tower_howitzer.png"),
  21. CANNON1 = load_texture("res/cannon1.png"),
  22. TOWER_HOWITZER_ICON = load_texture("res/tower_howitzer_icon.png"),
  23. TOWER_REDEYE = load_texture("res/tower_redeye.png"),
  24. TOWER_REDEYE_ICON = load_texture("res/tower_redeye_icon.png"),
  25. TOWER_MOAT = load_texture("res/tower_moat.png"),
  26. TOWER_MOAT_ICON = load_texture("res/tower_moat_icon.png"),
  27. TOWER_RADAR = load_texture("res/tower_radar.png"),
  28. TOWER_RADAR_ICON = load_texture("res/tower_radar_icon.png"),
  29. TOWER_LIGHTHOUSE = load_texture("res/tower_lighthouse.png"),
  30. TOWER_LIGHTHOUSE_ICON = load_texture("res/tower_lighthouse_icon.png"),
  31. HEX_FLOWER = load_texture("res/thing.png"),
  32. -- mob stuff
  33. MOB_BEEPER = load_texture("res/mob_beeper.png"),
  34. MOB_SPOODER = load_texture("res/mob_spooder.png"),
  35. }
  36. function pack_texture_into_sprite(texture, width, height, color)
  37. local sprite = am.sprite{
  38. texture = texture,
  39. s1 = 0, s2 = 1, t1 = 0, t2 = 1,
  40. x1 = 0, x2 = width, width = width,
  41. y1 = 0, y2 = height, height = height
  42. }
  43. sprite.color = color or vec4(1)
  44. return sprite
  45. end