Advertisement
Guest User

Untitled

a guest
Apr 9th, 2020
512
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. #==============================================================================#
  2. # Hecho por Elena/Slaqueen
  3. #==============================================================================#
  4. # Incluir esto en Scene_Map para lanzar bolas de fuego pulsando la tecla M:
  5. #
  6. # if Input.triggerex?(0x4D)
  7. # lanzarbolafuego
  8. # end
  9. #
  10. # En Game_Character, sustituir attr_reader :opacity por
  11. # attr_accessor :opacity
  12. #
  13. #==============================================================================#
  14.  
  15. #Puntos por modularidad
  16. #Puntos por identar y comentar
  17. PROYECTIL = "BolaFuego" #Nombre del evento que hace de proyectil
  18.  
  19. OBJETIVO = "Objetivo" #Nombre de los eventos objetivos
  20.  
  21. ESCOGERINTERRUPTOR = "A" #Interruptor local que se activa cuando el proyectil
  22. # hace contacto con el evento objetivo
  23.  
  24. def lanzarbolafuego
  25. #Lo cambiaría por un while
  26. for event in $game_map.events.values
  27.  
  28. if event.name == PROYECTIL
  29. eventofuego = $game_map.events[event.id]
  30. eventofuego.opacity = 255
  31. pbSEPlay("Fire1")
  32. eventofuego.moveto($game_player.x, $game_player.y)
  33. eventofuego.move_speed = 6
  34. #Bien usado
  35. if $game_player.direction == 2
  36. eventofuego.turn_down
  37. elsif $game_player.direction == 6
  38. eventofuego.turn_right
  39. elsif $game_player.direction == 4
  40. eventofuego.turn_left
  41. elsif $game_player.direction == 8
  42. eventofuego.turn_up
  43. end
  44. end
  45. end
  46.  
  47. #Lo cambiaría por un while en caso de que ya haya impactado contra algo
  48. 9.times do
  49. eventofuego.move_forward
  50.  
  51. for event in $game_map.events.values
  52. if event.name == OBJETIVO && (eventofuego.x == event.x) && (eventofuego.y == event.y)
  53. eventofuego.opacity = 0
  54. $game_self_switches[[$game_map.map_id, event.id, ESCOGERINTERRUPTOR]] = true
  55. $game_map.refresh
  56. end
  57. end
  58.  
  59. pbWait(2)
  60.  
  61. end
  62.  
  63. 5.times do
  64. eventofuego.opacity -= 51
  65. pbWait(1)
  66. end
  67.  
  68. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement