Advertisement
Caeles

Viejo menú Pole

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