Advertisement
Nightmare1304

Untitled

Apr 10th, 2020
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.72 KB | None | 0 0
  1. #The World of Krull version 0.1
  2. extends Panel
  3.  
  4. #VARIABLES
  5. var money = 0
  6. var timer
  7. var timer2
  8. onready var player_name = get_node("TabContainer/Options/TextEdit")
  9. onready var max_value = get_node("player_life").max_value
  10.  
  11. #Player
  12. var hp = 100
  13. var regen = 5
  14. var damage = 1
  15. var attdam = 1
  16. var total_damage = damage + attdam
  17.  
  18.  
  19. #Enemies
  20. #1
  21. var hp1 = 10
  22. var stg1 = 1
  23. var dam1 = 1
  24. var killcount1 = 0
  25. var money1 = 1
  26. #2
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33. #FUNCTIONS
  34. #Exit from the game
  35. func exit():
  36. get_tree().quit()
  37. #Chose the player nickname
  38. func name():
  39. player_name.get_text()
  40. get_node("player_name").set_text(str(player_name.text))
  41. get_node("TabContainer/Options/chose_name").visible = false
  42. get_node("TabContainer/Options/TextEdit").visible = false
  43. #Fight with enemy
  44. func fight1():
  45. hp = hp - stg1 - dam1
  46. hp1 = hp1 - total_damage
  47. if hp1 <=0:
  48. hp1 = 10
  49. killcount1 = killcount1 + 1
  50. money = money + money1
  51. #Timer
  52. #func timerstart():
  53. #timer.start()
  54. func _on_Timer_timeout():
  55. hp = hp + regen
  56. max_value = hp
  57. #Achievements
  58. func timerstart2():
  59. # warning-ignore:standalone_expression
  60. timer2.start()
  61. get_node("Popup").visible = true
  62. func _on_Timer_timeout2():
  63. get_node("Popup").visible = false
  64. #Upgrades
  65. func buy_attdam():
  66. attdam = attdam + 1
  67. money = money - 1
  68. print (total_damage)
  69. func attacco():
  70. attdam = attdam + 1
  71. print (total_damage)
  72.  
  73.  
  74.  
  75.  
  76. #READY
  77. func _ready():
  78. # warning-ignore:return_value_discarded
  79. get_node("exit").connect("pressed",self,"exit")
  80. # warning-ignore:return_value_discarded
  81. get_node("TabContainer/Options/chose_name").connect("pressed",self,"name")
  82. # warning-ignore:return_value_discarded
  83. get_node("TabContainer/Enemies/fightene1").connect("pressed",self,"fight1")
  84. #warning-ignore:return_value_discarded
  85. get_node("timer").connect("timeout",self,"_on_Timer_timeout")
  86. # warning-ignore:return_value_discarded
  87. #Achievements
  88. get_node("timer2").connect("timeout",self,"_on_Timer_timeout2")
  89. timer2 = get_node("timer2")
  90. # warning-ignore:return_value_discarded
  91. get_node("TabContainer/Upgrades/buy1").connect("pressed",self,"buy_attdam")
  92. # warning-ignore:return_value_discarded
  93. get_node("button").connect("pressed",self,"attacco")
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100. #DELTA
  101. func _process(_delta):
  102. get_node("TabContainer/Enemies/enhp1").set_value(hp1)
  103. get_node("player_life").set_value(hp)
  104. get_node("TabContainer/Enemies/killcount1").set_text(str(killcount1))
  105. #Player Death
  106. #if hp >= 100:
  107.  
  108. get_node("playerlifecount").set_text(str(hp))
  109. get_node("money_number").set_text(str(money))
  110. get_node("TabContainer/Upgrades/attdamvalue").set_text(str(total_damage))
  111. get_node("attdam_value").set_text(str(total_damage))
  112.  
  113. #Achievements
  114. #if killcount1 >2:
  115. #timerstart2()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement