- 11
- Posts
- 6
- Years
- Spain
- Seen Mar 8, 2025
Hi! This script allow you to play the Voltor Flip Minigame using the mouse and its keys. First, you need to know how this will work:
And that would be all! You just need to play the game and you'll be able to control it with the mouse.
In case you'd done too many changes, it's more worth it to do step by step all I've done.
First, below the def getInput add these lines:
Now, cut all the code between elsif Input.trigger?(Input::C) and the next condition elsif ... (excluding the last line) and move it to the last line of the method, above pbDrawImagePositions ... (make sure you haven't copied other condition).
Then, in the same condition, replace elsif Input.trigger?(Input::C) by this:
Now, since this copied line down to the end of the method, replace all @index by index (tip: use Cntrl+H, but don't use 'replace all'). If you don't know exactly how this should remain, look at the 'spoiler' code.
After, find elsif Input.trigger?(Input::B) and add in that same line this:
Lastly, find elsif Input.trigger?(Input::CTRL) and, again, add to the line this code:
And now you've done! Enjoy playing this game more comfortably!
- Left-clicking on a tile will flip it (or mark a memo on it).
- Right-clicking anywhere will ask to leave.
- Left-clicking on the left buttons will trigger them.
- You can still use the keyboard to play.
Spoiler:
Code:
def getInput
mousepos = Mouse::getMousePos() rescue [-1,-1] #!# Control with mouse
click = Input.triggerex?(Input::LeftMouseKey)
triggerc = Input.trigger?(Input::C)
if Input.trigger?(Input::UP)
pbPlayCursorSE
if @index[1]>0
@index[1]-=1
@sprites["cursor"].y-=64
else
@index[1]=4
@sprites["cursor"].y=256
end
elsif Input.trigger?(Input::DOWN)
pbPlayCursorSE
if @index[1]<4
@index[1]+=1
@sprites["cursor"].y+=64
else
@index[1]=0
@sprites["cursor"].y=0
end
elsif Input.trigger?(Input::LEFT)
pbPlayCursorSE
if @index[0]>0
@index[0]-=1
@sprites["cursor"].x-=64
else
@index[0]=4
@sprites["cursor"].x=256
end
elsif Input.trigger?(Input::RIGHT)
pbPlayCursorSE
if @index[0]<4
@index[0]+=1
@sprites["cursor"].x+=64
else
@index[0]=0
@sprites["cursor"].x=0
end
elsif Input.trigger?(Input::B) || (click && (10...118)===mousepos[0] && (332...372)===mousepos[1]) || Input.triggerex?(Input::RightMouseKey) #!# Control with mouse
@sprites["curtain"].opacity=100
if @points==0
if Kernel.pbConfirmMessage("You haven't found any Coins! Are you sure you want to quit?")
@sprites["curtain"].opacity=0
pbShowAndDispose
@quit=true
end
elsif Kernel.pbConfirmMessage(_INTL("If you quit now, you will recieve {1} Coin(s). Will you quit?",pbCommaNumber(@points)))
Kernel.pbMessage(_INTL("{1} received {2} Coin(s)!",$Trainer.name,pbCommaNumber(@points)))
Moneda(s)!",$Trainer.name,pbCommaNumber(@points)))
$PokemonGlobal.coins+=@points
@points=0
pbUpdateCoins
@sprites["curtain"].opacity=0
pbShowAndDispose
@quit=true
end
@sprites["curtain"].opacity=0
elsif Input.trigger?(Input::CTRL) || (click && (14...114)===mousepos[0] && (200..316)===mousepos[1]) #!# Mouse control
#!#CHANGED: click twice to have red voltorb marks
pbPlayDecisionSE
@sprites["cursor"].bitmap.clear
if @cursor[0][3]==0 # If in normal mode
@cursor[0]=[@directory+"cursor",128,0,64,0,64,64]
@sprites["memo"].visible=true
else # Mark mode
@cursor[0]=[@directory+"cursor",128,0,0,0,64,64]
@sprites["memo"].visible=false
end
elsif triggerc || click #!# Control with mouse -- Input.trigger?(Input::C)
index = click ? [((mousepos[0]-128)/64.0).floor,(mousepos[1]/64).floor] : @index
return if click && (index[0] < 0 || index[1] < 0)
if @markflag > 0 #!# If in mark mode
for i in [email protected]
if index[0]*64+128==@squares[i][0] && index[1]*64==@squares[i][1] && @squares[i][3]==false
pbSEPlay("Voltorb Flip mark")
end
end
for i in [email protected]+1
if @marks[i]==nil
@marks[i]=[@directory+"tiles",index[0]*64+128,index[1]*64,256,0,64,64]
elsif @marks[i][1]==index[0]*64+128 && @marks[i][2]==index[1]*64
@marks.delete_at(i)
@marks.compact!
@sprites["mark"].bitmap.clear
break
end
end
pbDrawImagePositions(@sprites["mark"].bitmap,@marks)
pbWait(2)
else
# Display the tile for the selected spot
icons=[]
for i in [email protected]
if index[0]*64+128==@squares[i][0] && index[1]*64==@squares[i][1] && @squares[i][3]==false
pbAnimateTile(index[0]*64+128,index[1]*64,@squares[i][2])
@squares[i][3]=true
# If Voltorb (0), display all tiles on the board
if @squares[i][2]==0
pbSEPlay("Voltorb Flip explosion")
# Play explosion animation
# Part1
animation=[]
for j in 0...3
animation[0]=icons[0]=[@directory+"tiles",index[0]*64+128,index[1]*64,704+(64*j),0,64,64]
pbDrawImagePositions(@sprites["animation"].bitmap,animation)
pbWait(3)
@sprites["animation"].bitmap.clear
end
# Part2
animation=[]
for j in 0...6
animation[0]=[@directory+"explosion",index[0]*64-32+128,index[1]*64-32,j*128,0,128,128]
pbDrawImagePositions(@sprites["animation"].bitmap,animation)
pbWait(3)
@sprites["animation"].bitmap.clear
end
# Unskippable text block, parameter 2 = wait time (corresponds to ME length)
Kernel.pbMessage(_INTL("\\me[Voltorb Flip game over]Oh no! You get 0 Coins!\\wtnp[50]"))
pbShowAndDispose
@sprites["mark"].bitmap.clear
if @level>1
# Determine how many levels to reduce by
newLevel=0
for j in [email protected]
if @squares[j][3]==true && @squares[j][2]>1
newLevel+=1
end
end
if newLevel>@level
newLevel=@level
end
if @level>newLevel
@level=newLevel
@level=1 if @level<1
Kernel.pbMessage(_INTL("\\se[Voltorb Flip level down]Dropped to Game Lv. {1}!",@level.to_s))
end
end
# Update level text
@sprites["level"].bitmap.clear
pbDrawShadowText(@sprites["level"].bitmap,8,150,118,28,"Nivel "[email protected]_s,Color.new(60,60,60),Color.new(150,190,170),1)
@points=0
pbUpdateCoins
# Revert numbers to 0s
@sprites["numbers"].bitmap.clear
for i in 0...5
pbUpdateRowNumbers(0,0,i)
pbUpdateColumnNumbers(0,0,i)
end
pbDisposeSpriteHash(@sprites)
@firstRound=false
pbNewGame
else
# Play tile animation
animation=[]
for j in 0...4
animation[0]=[@directory+"flipAnimation",index[0]*64-14+128,index[1]*64-16,j*92,0,92,96]
pbDrawImagePositions(@sprites["animation"].bitmap,animation)
pbWait(3)
@sprites["animation"].bitmap.clear
end
if @points==0
@points+=@squares[i][2]
pbSEPlay("Voltorb Flip point")
elsif @squares[i][2]>1
@points*=@squares[i][2]
pbSEPlay("Voltorb Flip point")
end
break
end
end
end
end
count=0
for i in [email protected]
if @squares[i][3]==false && @squares[i][2]>1
count+=1
end
end
pbUpdateCoins
# Game cleared
if count==0
@sprites["curtain"].opacity=100
Kernel.pbMessage(_INTL("\\me[Voltorb Flip win]Board clear!\\wtnp[40]"))
# Kernel.pbMessage(_INTL("You've found all of the hidden x2 and x3 cards."))
# Kernel.pbMessage(_INTL("This means you've found all the Coins in this game, so the game is now over."))
Kernel.pbMessage(_INTL("{1} received {2} Coins!",$Trainer.name,pbCommaNumber(@points)))
# Update level text
@sprites["level"].bitmap.clear
pbDrawShadowText(@sprites["level"].bitmap,8,150,118,28,_INTL("Level {1}",@level.to_s),Color.new(60,60,60),Color.new(150,190,170),1)
$PokemonGlobal.coins+=@points
@points=0
pbUpdateCoins
@sprites["curtain"].opacity=0
pbShowAndDispose
# Revert numbers to 0s
@sprites["numbers"].bitmap.clear
for i in 0...5
pbUpdateRowNumbers(0,0,i)
pbUpdateColumnNumbers(0,0,i)
end
@sprites["curtain"].opacity=100
if @level<8
@level+=1
Kernel.pbMessage(_INTL("Advanced to Game Lv. {1}!",@level.to_s))
# if @firstRound
# Kernel.pbMessage(_INTL("Congratulations!"))
# Kernel.pbMessage(_INTL("You can receive even more Coins in the next game!"))
@firstRound=false
# end
end
pbDisposeSpriteHash(@sprites)
pbNewGame
end
end
# Draw cursor
pbDrawImagePositions(@sprites["cursor"].bitmap,@cursor)
end
In case you'd done too many changes, it's more worth it to do step by step all I've done.
First, below the def getInput add these lines:
Code:
# def getInput
mousepos = Mouse::getMousePos() rescue [-1,-1] #!# Control with mouse
click = Input.triggerex?(Input::LeftMouseKey)
triggerc = Input.trigger?(Input::C)
Then, in the same condition, replace elsif Input.trigger?(Input::C) by this:
Code:
#elsif Input.trigger(Input::C)
elsif triggerc || click #!# Control with mouse Input.trigger?(Input::C)
index = click ? [((mousepos[0]-128)/64.0).floor,(mousepos[1]/64).floor] : @index
return if click && (index[0] < 0 || index[1] < 0)
Now, since this copied line down to the end of the method, replace all @index by index (tip: use Cntrl+H, but don't use 'replace all'). If you don't know exactly how this should remain, look at the 'spoiler' code.
After, find elsif Input.trigger?(Input::B) and add in that same line this:
Code:
|| (click && (10...118)===mousepos[0] && (332...372)===mousepos[1]) || Input.triggerex?(Input::RightMouseKey) #!# Control with mouse
Lastly, find elsif Input.trigger?(Input::CTRL) and, again, add to the line this code:
Code:
|| (click && (14...114)===mousepos[0] && (200..316)===mousepos[1]) #!# Control with mouse
And now you've done! Enjoy playing this game more comfortably!