Advertisement
Guest User

Untitled

a guest
Apr 17th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.90 KB | None | 0 0
  1. class Menu2
  2. def update;end
  3.  
  4. def pbStartScene # CARGA LAS COSAS
  5. @sprites={}
  6. @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
  7. @viewport.z=99999
  8.  
  9. @sprites["bg"]=Sprite.new(@viewport)
  10. @sprites["bg"].bitmap=RPG::Cache.picture("menu_bg")
  11.  
  12. logros=["Profesora Pokémon","Cotilla", "Loca de las setas"]
  13. textpos=[]
  14. textpos.push([_INTL("{1}",logros[$game_variables[51]]),50,10,0,
  15. Color.new(255,255,255),Color.new(88,88,80)])
  16. @sprites["logros"]=Sprite.new(@viewport)
  17.  
  18. if $game_variables[51]==0
  19. @sprites["logros"].bitmap=pbBitmap("Graphics/Pictures/logros/logros0")
  20. #@sprites["logros"].bitmap=RPG::Cache.picture("logros")
  21. @sprites["logros"].x=10
  22. @sprites["logros"].y=8
  23. @sprites["logros"].z=99999
  24. end
  25. if $game_variables[51]==1
  26. @sprites["logros"].bitmap=pbBitmap("Graphics/Pictures/logros/logros1")
  27. @sprites["logros"].x=8
  28. @sprites["logros"].y=8
  29. @sprites["logros"].z=99999
  30. end
  31. if $game_variables[51]==2
  32. @sprites["logros"].bitmap=pbBitmap("Graphics/Pictures/logros/logros2")
  33. @sprites["logros"].x=3
  34. @sprites["logros"].y=6
  35. @sprites["logros"].z=99999
  36. end
  37.  
  38. @sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
  39. @sprites["overlay"].z = 99999
  40. @texts = @sprites["overlay"].bitmap
  41. @sprites["overlay"].bitmap.clear
  42. pbSetSystemFont(@sprites["overlay"].bitmap)
  43. pbDrawTextPositions(@texts,textpos)
  44.  
  45.  
  46.  
  47. @totalElements = 9
  48. radius = 100
  49.  
  50. counter = 0;
  51. @sprites["pokedex"]=Sprite.new(@viewport)
  52. @sprites["pokedex"].bitmap=RPG::Cache.picture("calculator")
  53. @sprites["pokedex"].x=getXPolygon(counter, @totalElements, Graphics.width/2, radius) - (@sprites["pokedex"].bitmap.width/2)
  54. @sprites["pokedex"].y=getYPolygon(counter, @totalElements, Graphics.height/2, radius) - (@sprites["pokedex"].bitmap.height/2)
  55. @sprites["pokedex"].z=99999
  56.  
  57. counter += 1
  58. @sprites["pokeball"]=Sprite.new(@viewport)
  59. @sprites["pokeball"].bitmap=RPG::Cache.picture("record")
  60. @sprites["pokeball"].x=getXPolygon(counter, @totalElements, Graphics.width/2, radius) - (@sprites["pokeball"].bitmap.width/2)
  61. @sprites["pokeball"].y=getYPolygon(counter, @totalElements, Graphics.height/2, radius) - (@sprites["pokeball"].bitmap.height/2)
  62. @sprites["pokeball"].z=99999
  63.  
  64. counter += 1
  65. @sprites["cofre"]=Sprite.new(@viewport)
  66. @sprites["cofre"].bitmap=RPG::Cache.picture("cofre")
  67. @sprites["cofre"].x=getXPolygon(counter, @totalElements, Graphics.width/2, radius) - (@sprites["cofre"].bitmap.width/2)
  68. @sprites["cofre"].y=getYPolygon(counter, @totalElements, Graphics.height/2, radius) - (@sprites["cofre"].bitmap.height/2)
  69. @sprites["cofre"].z=99999
  70.  
  71. counter += 1
  72. @sprites["user"]=Sprite.new(@viewport)
  73. @sprites["user"].bitmap=RPG::Cache.picture("user")
  74. @sprites["user"].x=getXPolygon(counter, @totalElements, Graphics.width/2, radius) - (@sprites["user"].bitmap.width/2)
  75. @sprites["user"].y=getYPolygon(counter, @totalElements, Graphics.height/2, radius) - (@sprites["user"].bitmap.height/2)
  76. @sprites["user"].z=99999
  77.  
  78. counter += 1
  79. @sprites["opciones"]=Sprite.new(@viewport)
  80. @sprites["opciones"].bitmap=RPG::Cache.picture("tools")
  81. @sprites["opciones"].x=getXPolygon(counter, @totalElements, Graphics.width/2, radius) - (@sprites["opciones"].bitmap.width/2)
  82. @sprites["opciones"].y=getYPolygon(counter, @totalElements, Graphics.height/2, radius) - (@sprites["opciones"].bitmap.height/2)
  83. @sprites["opciones"].z=99999
  84.  
  85. counter += 1
  86. @sprites["save"]=Sprite.new(@viewport)
  87. @sprites["save"].bitmap=RPG::Cache.picture("save")
  88. @sprites["save"].x=getXPolygon(counter, @totalElements, Graphics.width/2, radius) - (@sprites["save"].bitmap.width/2)
  89. @sprites["save"].y=getYPolygon(counter, @totalElements, Graphics.height/2, radius) - (@sprites["save"].bitmap.height/2)
  90. @sprites["save"].z=99999
  91.  
  92. counter += 1
  93. @sprites["exit"]=Sprite.new(@viewport)
  94. @sprites["exit"].bitmap=RPG::Cache.picture("exit")
  95. @sprites["exit"].x=getXPolygon(counter, @totalElements, Graphics.width/2, radius) - (@sprites["exit"].bitmap.width/2)
  96. @sprites["exit"].y=getYPolygon(counter, @totalElements, Graphics.height/2, radius) - (@sprites["exit"].bitmap.height/2)
  97. @sprites["exit"].z=99999
  98.  
  99. counter += 1
  100. @sprites["misiones"]=Sprite.new(@viewport)
  101. @sprites["misiones"].bitmap=RPG::Cache.picture("misiones")
  102. @sprites["misiones"].x=getXPolygon(counter, @totalElements, Graphics.width/2, radius) - (@sprites["misiones"].bitmap.width/2)
  103. @sprites["misiones"].y=getYPolygon(counter, @totalElements, Graphics.height/2, radius) - (@sprites["misiones"].bitmap.height/2)
  104. @sprites["misiones"].z=99999
  105.  
  106. counter += 1
  107. @sprites["misiones"]=Sprite.new(@viewport)
  108. @sprites["misiones"].bitmap=RPG::Cache.picture("misiones")
  109. @sprites["misiones"].x=getXPolygon(counter, @totalElements, Graphics.width/2, radius) - (@sprites["misiones"].bitmap.width/2)
  110. @sprites["misiones"].y=getYPolygon(counter, @totalElements, Graphics.height/2, radius) - (@sprites["misiones"].bitmap.height/2)
  111. @sprites["misiones"].z=99999
  112.  
  113. @sprites["shine"]=Sprite.new(@viewport)
  114. @sprites["shine"].bitmap=RPG::Cache.picture("resplan")
  115. @sprites["shine"].x = @sprites["pokedex"].x
  116. @sprites["shine"].y = @sprites["pokedex"].y
  117. @sprites["shine"].z=99998
  118.  
  119. @sprites["title"]=Sprite.new(@viewport)
  120. @sprites["title"].z=99999
  121.  
  122. pbSEPlay("menu")
  123. end
  124.  
  125. def pbEndScene # CUANDO TERMINA...
  126. pbDisposeSpriteHash(@sprites)
  127. @viewport.dispose if @viewport
  128. end
  129.  
  130. def pbUpdate
  131. @xcount=0
  132. @posible1=0
  133. @posible2=0
  134. @posible3=0
  135. loop do
  136. Graphics.update
  137. Input.update
  138.  
  139. ################### FUNCIONES AQUÍ #######
  140.  
  141. if Input.trigger?(Input::RIGHT)
  142. @xcount=@xcount+1
  143. end
  144.  
  145. if Input.trigger?(Input::LEFT)
  146. @xcount=@xcount-1
  147. end
  148.  
  149. if (@xcount == -1)
  150. @xcount= @totalElements-1
  151. end
  152.  
  153. if (@xcount == @totalElements)
  154. @xcount=0
  155. end
  156.  
  157. if (@xcount==0)
  158. @sprites["title"].bitmap=RPG::Cache.picture("ndex")
  159. @sprites["title"].x = (Graphics.width-@sprites["title"].bitmap.width)/2
  160. @sprites["title"].y = (Graphics.height-@sprites["title"].bitmap.height)/2
  161.  
  162. @sprites["shine"].x = @sprites["pokedex"].x - (@sprites["shine"].bitmap.width-@sprites["pokedex"].bitmap.width)/2
  163. @sprites["shine"].y = @sprites["pokedex"].y - (@sprites["shine"].bitmap.height-@sprites["pokedex"].bitmap.height)/2
  164.  
  165.  
  166. if Input.trigger?(Input::C) and !$Trainer.pokedex
  167. Kernel.pbMessage(_INTL("You haven't got the pokédex."))
  168. end
  169.  
  170. if Input.trigger?(Input::C)
  171. if DEXDEPENDSONLOCATION
  172. pbFadeOutIn(99999) {
  173. scene=PokemonPokedexScene.new
  174. screen=PokemonPokedex.new(scene)
  175. screen.pbStartScreen
  176. #@scene.pbRefresh
  177. }
  178. else
  179. if $PokemonGlobal.pokedexViable.length==1
  180. $PokemonGlobal.pokedexDex=$PokemonGlobal.pokedexViable[0]
  181. $PokemonGlobal.pokedexDex=-1
  182. if $PokemonGlobal.pokedexDex==$PokemonGlobal.pokedexUnlocked.length-1
  183. pbFadeOutIn(99999) {
  184. scene=PokemonPokedexScene.new
  185. screen=PokemonPokedex.new(scene)
  186. screen.pbStartScreen
  187. #@scene.pbRefresh
  188. }
  189. else
  190. pbLoadRpgxpScene(Scene_PokedexMenu.new)
  191. end
  192. end
  193. end
  194. end
  195. end
  196.  
  197. if (@xcount==1)
  198. @sprites["title"].bitmap=RPG::Cache.picture("npk")
  199. @sprites["title"].x = (Graphics.width-@sprites["title"].bitmap.width)/2
  200. @sprites["title"].y = (Graphics.height-@sprites["title"].bitmap.height)/2
  201.  
  202. @sprites["shine"].x = @sprites["pokeball"].x - (@sprites["shine"].bitmap.width-@sprites["pokeball"].bitmap.width)/2
  203. @sprites["shine"].y = @sprites["pokeball"].y - (@sprites["shine"].bitmap.height-@sprites["pokeball"].bitmap.height)/2
  204.  
  205. if $Trainer.party.length<1
  206. if Input.trigger?(Input::C)
  207. Kernel.pbMessage(_INTL("You haven't got any pokémon."))
  208. end
  209. end
  210. if Input.trigger?(Input::C)
  211. sscene=PokemonScreen_Scene.new
  212. sscreen=PokemonScreen.new(sscene,$Trainer.party)
  213. hiddenmove=nil
  214. pbFadeOutIn(99999) {
  215. hiddenmove=sscreen.pbPokemonScreen
  216. if hiddenmove
  217. pbEndScene
  218. else
  219. #@scene.pbRefresh
  220. end
  221. }
  222. if hiddenmove
  223. Kernel.pbUseHiddenMove(hiddenmove[0],hiddenmove[1])
  224. return
  225. end
  226. end
  227. end
  228.  
  229. if (@xcount==2)
  230. @sprites["title"].bitmap=RPG::Cache.picture("nbag")
  231. @sprites["title"].x = (Graphics.width-@sprites["title"].bitmap.width)/2
  232. @sprites["title"].y = (Graphics.height-@sprites["title"].bitmap.height)/2
  233.  
  234. @sprites["shine"].x = @sprites["cofre"].x - (@sprites["shine"].bitmap.width-@sprites["cofre"].bitmap.width)/2
  235. @sprites["shine"].y = @sprites["cofre"].y - (@sprites["shine"].bitmap.height-@sprites["cofre"].bitmap.height)/2
  236.  
  237. if Input.trigger?(Input::C)
  238. item=0
  239. scene=PokemonBag_Scene.new
  240. screen=PokemonBagScreen.new(scene,$PokemonBag)
  241. pbFadeOutIn(99999) {
  242. item=screen.pbStartScreen
  243. if item>0
  244. pbEndScene
  245. else
  246. #@scene.pbRefresh
  247. end
  248. }
  249. if item>0
  250. Kernel.pbUseKeyItemInField(item)
  251. return
  252. end
  253. end
  254. end
  255.  
  256. if (@xcount==3)
  257. @sprites["title"].bitmap=RPG::Cache.picture("nplayer")
  258. @sprites["title"].x = (Graphics.width-@sprites["title"].bitmap.width)/2
  259. @sprites["title"].y = (Graphics.height-@sprites["title"].bitmap.height)/2
  260.  
  261. @sprites["shine"].x = @sprites["user"].x - (@sprites["shine"].bitmap.width-@sprites["user"].bitmap.width)/2
  262. @sprites["shine"].y = @sprites["user"].y - (@sprites["shine"].bitmap.height-@sprites["user"].bitmap.height)/2
  263.  
  264. if Input.trigger?(Input::C)
  265. PBDebug.logonerr {
  266. scene=PokemonTrainerCardScene.new
  267. screen=PokemonTrainerCard.new(scene)
  268. pbFadeOutIn(99999) {
  269. screen.pbStartScreen
  270. #@scene.pbRefresh
  271. }
  272. }
  273. end
  274. end
  275.  
  276. if (@xcount==4)
  277. @sprites["title"].bitmap=RPG::Cache.picture("nop")
  278. @sprites["title"].x = (Graphics.width-@sprites["title"].bitmap.width)/2
  279. @sprites["title"].y = (Graphics.height-@sprites["title"].bitmap.height)/2
  280.  
  281. @sprites["shine"].x = @sprites["opciones"].x - (@sprites["shine"].bitmap.width-@sprites["opciones"].bitmap.width)/2
  282. @sprites["shine"].y = @sprites["opciones"].y - (@sprites["shine"].bitmap.height-@sprites["opciones"].bitmap.height)/2
  283.  
  284. if Input.trigger?(Input::C)
  285. scene=PokemonOptionScene.new
  286. screen=PokemonOption.new(scene)
  287. pbFadeOutIn(99999) {
  288. screen.pbStartScreen
  289. pbUpdateSceneMap
  290. #@scene.pbRefresh
  291. }
  292. end
  293. end
  294.  
  295. if (@xcount==5)
  296. @sprites["title"].bitmap=RPG::Cache.picture("nsv")
  297. @sprites["title"].x = (Graphics.width-@sprites["title"].bitmap.width)/2
  298. @sprites["title"].y = (Graphics.height-@sprites["title"].bitmap.height)/2
  299.  
  300. @sprites["shine"].x = @sprites["save"].x - (@sprites["shine"].bitmap.width-@sprites["save"].bitmap.width)/2
  301. @sprites["shine"].y = @sprites["save"].y - (@sprites["shine"].bitmap.height-@sprites["save"].bitmap.height)/2
  302.  
  303. if Input.trigger?(Input::C)
  304. scene=PokemonSaveScene.new
  305. screen=PokemonSave.new(scene)
  306. if screen.pbSaveScreen
  307. endscene=false
  308. break
  309. else
  310. pbUpdateSceneMap
  311. end
  312. end
  313. end
  314.  
  315. if (@xcount==6)
  316. @sprites["title"].bitmap=RPG::Cache.picture("nxt")
  317. @sprites["title"].x = (Graphics.width-@sprites["title"].bitmap.width)/2
  318. @sprites["title"].y = (Graphics.height-@sprites["title"].bitmap.height)/2
  319.  
  320. @sprites["shine"].x = @sprites["exit"].x - (@sprites["shine"].bitmap.width-@sprites["exit"].bitmap.width)/2
  321. @sprites["shine"].y = @sprites["exit"].y - (@sprites["shine"].bitmap.height-@sprites["exit"].bitmap.height)/2
  322.  
  323. break if Input.trigger?(Input::C)
  324. end
  325.  
  326. if (@xcount==7)
  327. @sprites["title"].bitmap=RPG::Cache.picture("nfo")
  328. @sprites["title"].x = (Graphics.width-@sprites["title"].bitmap.width)/2
  329. @sprites["title"].y = (Graphics.height-@sprites["title"].bitmap.height)/2
  330.  
  331. @sprites["shine"].x = @sprites["misiones"].x - (@sprites["shine"].bitmap.width-@sprites["misiones"].bitmap.width)/2
  332. @sprites["shine"].y = @sprites["misiones"].y - (@sprites["shine"].bitmap.height-@sprites["misiones"].bitmap.height)/2
  333.  
  334. if Input.trigger?(Input::C)
  335. pbInformes()
  336. end
  337. end
  338.  
  339. if (@xcount==8)
  340. @sprites["title"].bitmap=RPG::Cache.picture("noi")
  341. @sprites["title"].x = (Graphics.width-@sprites["title"].bitmap.width)/2
  342. @sprites["title"].y = (Graphics.height-@sprites["title"].bitmap.height)/2
  343. @sprites["shine"].x = @sprites["misiones"].x - (@sprites["shine"].bitmap.width-@sprites["misiones"].bitmap.width)/2
  344. @sprites["shine"].y = @sprites["misiones"].y - (@sprites["shine"].bitmap.height-@sprites["misiones"].bitmap.height)/2
  345.  
  346. if Input.trigger?(Input::C)
  347. showMissions()
  348. end
  349. end
  350. ###########################################
  351.  
  352. break if Input.trigger?(Input::B) # CIERRA EL MENÚ
  353.  
  354. end
  355.  
  356. end
  357.  
  358. end # Cierra la class
  359.  
  360. ###################################################
  361.  
  362. def pbCallMenu2
  363. scene=Menu2.new
  364. scene.pbStartScene
  365. scene.pbUpdate
  366. scene.pbEndScene
  367. end
  368.  
  369.  
  370. def getXPolygon(element, total, x_centre, radius)
  371. return radius * Math.cos(2*Math::PI*element/total + (Math::PI*1.5)) + x_centre
  372. end
  373.  
  374. def getYPolygon(element, total, y_centre, radius)
  375. return radius * Math.sin(2*Math::PI*element/total + (Math::PI*1.5)) + y_centre
  376. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement