[Essentials]Head It! v1.0
Sept 16, 2014 19:12:15 GMT -4
Post por Drimer en Sept 16, 2014 19:12:15 GMT -4
He decidido adaptar mi minijuego a Pokémon Essentials, dado que no logré hacer compatible mi módulo de Físicas he tenido que hacer todo a base de funciones matemáticas.
Instrucciones:
Requisitos:
Captura:
Descarga de gráficos:
Descargar desde Box
A continuación, el script:
Instrucciones:
- Colocar encima de MAIN
- Colocar los gráficos en la ruta: Graphics/WaE/Head It/
- Re-dimensionar tu pantalla de juego a (600x820)/2 ** Si tienes dudas, mira este tutorial **
- Elegir el Pokémon con el que jugarás. ** Si tienes dudas, mira este tutorial, está en inglés pero luego se los traduciré **
- Para iniciar el minijuego basta con llamar al script pbHeadIt.
Requisitos:
- Módulo Drimer-Core
- Pokémon Essentials 12.1 o superior
- Sistema de Oscuridad
Captura:
Descarga de gráficos:
Descargar desde Box
A continuación, el script:
#==============================================================================#
# ** Head It! Minigame! | De Drimer
#==============================================================================#
class HeadButtMinigame
begin
#----------------------------------------------------------------------------#
# ** Inicia la escena
#----------------------------------------------------------------------------#
def pbStartScene
load_data
pbBGMPlay("Head It")
wait(5)
Graphics.transition(20)
@sprites = {}
@sprites["bg"] = Sprite.new
@sprites["bg"].bitmap = Bitmap.new("Graphics/WaE/Head It/Background")
@sprites["counter"] = Sprite.new
@sprites["counter"].bitmap = Bitmap.new("Graphics/WaE/Head It/Counter")
@sprites["counter"].ox = @sprites["counter"].bitmap.width/2
@sprites["counter"].oy = @sprites["counter"].bitmap.height/2
@sprites["counter"].x = 74 ; @sprites["counter"].y = 436 + 24
@sprites["top"] = Sprite.new ; @sprites["bottom"] = Sprite.new
@sprites["top"].bitmap = Bitmap.new("Graphics/WaE/Head It/Top_Bar")
@sprites["bottom"].bitmap = Bitmap.new("Graphics/WaE/Head It/Bottom_Bar")
@sprites["top"].z = 9999 ; @sprites["bottom"].z = 9999
@sprites["bottom"].y= 410
@sprites["ready"] = Sprite.new
@sprites["ready"].bitmap = Bitmap.new("Graphics/WaE/Head It/Ready")
@sprites["ready"].ox = @sprites["ready"].bitmap.width/2
@sprites["ready"].oy = @sprites["ready"].bitmap.height/2
@sprites["ready"].x = 300 ; @sprites["ready"].y = 205
@sprites["ready"].zoom_x = 4.0 ; @sprites["ready"].zoom_y = 4.0
@sprites["ready"].opacity = 0
@sprites["go"] = Sprite.new
@sprites["go"].bitmap = Bitmap.new("Graphics/WaE/Head It/Go!")
@sprites["go"].ox = @sprites["go"].bitmap.width/2
@sprites["go"].oy = @sprites["go"].bitmap.height/2
@sprites["go"].x = 300 ; @sprites["go"].y = 205
@sprites["go"].zoom_x = 4.0 ;@sprites["go"].zoom_y = 4.0
@sprites["go"].opacity = 0
@sprites["bar"] = Sprite.new
@sprites["bar"].bitmap = Bitmap.new("Graphics/WaE/Head It/Progress_Bar")
@sprites["bar"].y = 400
@sprites["bar"].src_rect.set(0,0,0,10)
@sprites["Pokémon"] = PokemonSprite.new
@sprites["Pokémon"].setPokemonBitmap($Trainer.party[@poke])
@sprites["Pokémon"].ox = @sprites["Pokémon"].bitmap.width/2
@sprites["Pokémon"].oy = @sprites["Pokémon"].bitmap.height/2
@sprites["Pokémon"].x = $mouse.x
@sprites["Pokémon"].y = 150 + 780 - @sprites["Pokémon"].bitmap.height/2
@sprites["Pokémon"].visible = false
end
#----------------------------------------------------------------------------#
# ** Proceso principal de la escena
#----------------------------------------------------------------------------#
def pbRunScene
begin_animation
counter
loop do
Graphics.update
Input.update
$mouse.update
update_bar
@sprites["Pokémon"].update
@sprites["Pokémon"].x = $mouse.x
if @counter != @contador
clear_counter
counter
@contador = @counter
end
touch?
main_proccess
if @timer <= 0
break
end
end
clear_counter
counter
@contador = @counter
update
score_scene
wait(5)
if @score > $Trainer.head_it_record
call_high_score
end
loop do
update
@sprites["Pokémon"].update
@sprites["Pokémon"].x = $mouse.x
anim_record if @sprites["high"]
if @sprites["high"]
if @breakable == true
break
end
else
if pbPressAnyKey or pbPressAnyMouse
break
end
end
end
end
#----------------------------------------------------------------------------#
# ** Termina y destruye los datos
#----------------------------------------------------------------------------#
def pbEndScene
$Trainer.party[(@poke)].changeFriendship((@total/100))
if $Trainer.darkness >= 1
$Trainer.changeDarkness(((@total/100)/2))
end
if @score > $Trainer.head_it_record
$Trainer.head_it_record = @score
end
clear_record if @sprites["high"]
wait(2)
clear_score
wait(2)
20.times do
Graphics.update
@sprites["bottom"].y -= 21
@sprites["top"].y += 21
end
Graphics.freeze
pbDisposeSpriteHash(@sprites)
pbBGMStop
Graphics.update
Graphics.transition
puts "La amistad con #{@pokemon} es de #{$Trainer.party[(@poke)].friendship}"
end
#----------------------------------------------------------------------------#
# ** Realiza el proceso de los ovillos.
#----------------------------------------------------------------------------#
def main_proccess
case rand(15)
when 0
ball_proccess
wait(5)
@sprites["ball#{@counter_1}"].opacity = 0
update
wait(2)
end
end
#----------------------------------------------------------------------------#
# ** Proceso principal de los ovillos.
#----------------------------------------------------------------------------#
def ball_proccess
generate_ball
move_ball
end
#----------------------------------------------------------------------------#
# ** Mueve el ovillo
#----------------------------------------------------------------------------#
def move_ball
if @collision == false
pbSEPlay("throw")
for i in 0..29
update
if @sprites["ball#{@counter_1}"].disposed?
return
end
if @sprites["ball#{@counter_1}"] && @collision == false
@sprites["ball#{@counter_1}"].y += @gravity*(@plus_y[i]*2)
@sprites["ball#{@counter_1}"].angle += 2
collide?
end
end
end
end
#----------------------------------------------------------------------------#
# ** Genera un ovillo.
#----------------------------------------------------------------------------#
def generate_ball
puts "Generando Ball ##{@counter_1}" if @counter_1 >= 1
if @collision == true
@collision = false
end
@counter_1 += 1
@x_values = [50,100,150,200,250,300,350,400,450,500,550]
@sprites["ball#{@counter_1}"] = Sprite.new
case rand(4)
when 0
@sprites["ball#{@counter_1}"].bitmap = Bitmap.new("Graphics/WaE/Head It/Blue_Ball")
when 1
@sprites["ball#{@counter_1}"].bitmap = Bitmap.new("Graphics/WaE/Head It/Orange_Ball")
when 2
@sprites["ball#{@counter_1}"].bitmap = Bitmap.new("Graphics/WaE/Head It/Red_Ball")
when 3
@sprites["ball#{@counter_1}"].bitmap = Bitmap.new("Graphics/WaE/Head It/Pink_Ball")
end
@sprites["ball#{@counter_1}"].ox = @sprites["ball#{@counter_1}"].bitmap.width/2
@sprites["ball#{@counter_1}"].oy = @sprites["ball#{@counter_1}"].bitmap.height/2
case rand(10)
when 0
@sprites["ball#{@counter_1}"].x = @x_values[0]
when 1
@sprites["ball#{@counter_1}"].x = @x_values[1]
when 2
@sprites["ball#{@counter_1}"].x = @x_values[2]
when 3
@sprites["ball#{@counter_1}"].x = @x_values[3]
when 4
@sprites["ball#{@counter_1}"].x = @x_values[4]
when 5
@sprites["ball#{@counter_1}"].x = @x_values[5]
when 6
@sprites["ball#{@counter_1}"].x = @x_values[6]
when 7
@sprites["ball#{@counter_1}"].x = @x_values[7]
when 8
@sprites["ball#{@counter_1}"].x = @x_values[8]
when 9
@sprites["ball#{@counter_1}"].x = @x_values[9]
end
@sprites["ball#{@counter_1}"].y = -(@sprites["ball#{@counter_1}"].bitmap.height)
@sprites["ball#{@counter_1}"].z = 99999
end
#----------------------------------------------------------------------------#
# ** Proceso de comprobación de colisión
#----------------------------------------------------------------------------#
def collide?
if Input.pressed(Input::Mouse_Left)
pbSEPlay("jump")
5.times do
update
check_y
if @collision == false
@sprites["Pokémon"].y -= 8
end
if @sprites["ball#{@counter_1}"] && @collision == false
@sprites["ball#{@counter_1}"].y += @gravity*(@plus_y[24]*2)
@sprites["ball#{@counter_1}"].angle += 2
end
end
5.times do
update
check_y
if @collision == false
@sprites["Pokémon"].y += 8
end
if @sprites["ball#{@counter_1}"] && @collision == false
@sprites["ball#{@counter_1}"].y += @gravity*(@plus_y[24]*2)
@sprites["ball#{@counter_1}"].angle += 2
end
end
end
if @sprites["ball#{@counter_1}"]
if @sprites["ball#{@counter_1}"].y > 820
@cadena = 0
end
end
end
#----------------------------------------------------------------------------#
# ** Comprueba si han colisionado los objetos
#----------------------------------------------------------------------------#
def check_y
if @sprites["ball#{@counter_1}"]
if @sprites["Pokémon"].y-@sprites["ball#{@counter_1}"].y <= @collision_min &&
@sprites["Pokémon"].y-@sprites["ball#{@counter_1}"].y >= -@collision_min/2 &&
@sprites["Pokémon"].x-@sprites["ball#{@counter_1}"].x <= @sprites["ball#{@counter_1}"].bitmap.width/2 &&
@sprites["Pokémon"].x-@sprites["ball#{@counter_1}"].x >= -@sprites["ball#{@counter_1}"].bitmap.width/2
@value = @sprites["Pokémon"].y-@sprites["ball#{@counter_1}"].y
@collision = true
puts "Colision con la Ball ##{@counter_1}!"
ball_rejected
@counter += 1
puts "Contador ##{@counter}"
else
return
end
end
end
#----------------------------------------------------------------------------#
# ** Rebota el ovillo en caso de colisión
#----------------------------------------------------------------------------#
def ball_rejected
pbSEPlay("Wind7")
puts "Moving up Ball ##{@counter_1}"
@sprites["Pokémon"].y = 780-@sprites["Pokémon"].bitmap.height/2
pbSEPlay("jump")
5.times do
update
if @sprites["ball#{@counter_1}"]
@sprites["ball#{@counter_1}"].y-=@gravity*(@plus_y[24]*2)
@sprites["ball#{@counter_1}"].angle-=4
end
@sprites["Pokémon"].y -= 8
end
5.times do
update
if @sprites["ball#{@counter_1}"]
@sprites["ball#{@counter_1}"].y-=@gravity*(@plus_y[24]*2)
@sprites["ball#{@counter_1}"].angle-=4
end
@sprites["Pokémon"].y += 8
end
18.times do
update
if @sprites["ball#{@counter_1}"]
@sprites["ball#{@counter_1}"].y-=@gravity*(@plus_y[24]*2)
@sprites["ball#{@counter_1}"].angle-=4
end
end
if @sprites["ball#{@counter_1}"]
@sprites["ball#{@counter_1}"].y=-@sprites["ball#{@counter_1}"].bitmap.height-100
end
@sprites["Pokémon"].y =780-@sprites["Pokémon"].bitmap.height/2
update
@cadena += 1
puts "Cadena #{@cadena}"
end
#----------------------------------------------------------------------------#
# ** Comprueba si se acciona el Mouse y no hay colisión
#----------------------------------------------------------------------------#
def touch?
if pbMouseLeftClick?(@sprites["Pokémon"])
pbSEPlay("jump")
5.times do
update
if @collision == false
@sprites["Pokémon"].y-=8
end
if @sprites["ball#{@counter_1}"] && @collision == false
@sprites["ball#{@counter_1}"].y+=@gravity*(@plus_y[24]*2)
@sprites["ball#{@counter_1}"].angle+=2
end
end
5.times do
update
if @collision == false
@sprites["Pokémon"].y += 8
end
if @sprites["ball#{@counter_1}"] && @collision == false
@sprites["ball#{@counter_1}"].y+=@gravity*(@plus_y[24]*2)
@sprites["ball#{@counter_1}"].angle+=2
end
end
end
end
#----------------------------------------------------------------------------#
# ** Actualiza la Barra de Progreso
#----------------------------------------------------------------------------#
def update_bar
@sprites["bar"].dispose
@sprites["bar"] = Sprite.new
@sprites["bar"].bitmap = Bitmap.new("Graphics/WaE/Head It/Progress_Bar")
@sprites["bar"].y = 400
@sprites["bar"].src_rect.set(0,0,(100/1800)*@progress,10)
Graphics.update
@sprites["bar"].visible = true
end
#----------------------------------------------------------------------------#
# ** Proceso de actualización
#----------------------------------------------------------------------------#
def update
@timer-=1
@progress+=1
@sprites["Pokémon"].update
@sprites["Pokémon"].x = $mouse.x
Graphics.update
Input.update
$mouse.update
end
#----------------------------------------------------------------------------#
# ** Espera un numero de frames
#----------------------------------------------------------------------------#
def wait(frames)
frames.times do
Graphics.update
end
end
#----------------------------------------------------------------------------#
# ** Comprueba si ha terminado la escena
#----------------------------------------------------------------------------#
def finish?
if @counter==0
return true
end
if Input.pressed(Input::Mouse_Right)
return true
end
end
#----------------------------------------------------------------------------#
# ** Contador de Puntuación
#----------------------------------------------------------------------------#
def counter
if @counter >= 1
case @value
when 0..1
@data = 10 * 7
when 2..3
@data = 10 * 6
when 4..5
@data = 10 * 5
when 6..7
@data = 10 * 4
when 8..9
@data = 10 * 3
when 10
@data = 10 * 2
else
@data = 10 * 1
end
elsif @counter == 0
@data = 0
end
@score = @score + @data
@sprites["cont"] = Sprite.new
@sprites["cont"].bitmap = Bitmap.new(150,100)
@sprites["cont"].y = 390
@overlay = @sprites["cont"].bitmap
x = @sprites["counter"].bitmap.width/2 - 30
y = @sprites["counter"].bitmap.height/2
timer = []
timer.push([_INTL("#{@score}"),x,y,3,Color.new(0,0,0),$color1_s])
@sprites["cont"].bitmap.font.size = 92
pbSetSystemFont(@sprites["cont"].bitmap)
pbDrawTextPositions(@overlay,timer)
pbSEPlay("Voltorb Flip Point")
end
#----------------------------------------------------------------------------#
# ** Elimina el contador
#----------------------------------------------------------------------------#
def clear_counter
@sprites["cont"].dispose
@overlay.dispose
end
#----------------------------------------------------------------------------#
# ** Inicia los datos
#----------------------------------------------------------------------------#
def load_data
@poke=$game_variables[1]
@pokemon=$game_variables[3]
@timer=1800
@progress=0
@counter_1=0
@contador=@counter
@cadena=0
@score=0
@collision_min=30
@collide=false
@collision=false
@breakable=false
@counter=0
@gravity=9.81
@plus_y= [
1,1,1,1,1,
1,1,1,1,1,
1,1,1,1,1,
2,2,2,2,2,
3,3,3,3,3,
4,4,4,4,4
]
end
#----------------------------------------------------------------------------#
# ** Muestra la puntuación
#----------------------------------------------------------------------------#
def score_scene
@bonus = @cadena*2+rand(10)
@total = @score+@cadena*10+@bonus
@score_screen = Viewport.new(0,0,600,410)
@sprites["score"] = Sprite.new(@score_screen)
@sprites["score"].bitmap = Bitmap.new("Graphics/WaE/Head It/Score")
@sprites["score"].x = 29 ; @sprites["score"].y = 33
@sprites["score"].zoom_x = 0 ; @sprites["score"].zoom_y = 0
@score_over = @sprites["score"].bitmap
@info = [
"#{@score}",
"#{@cadena} x10",
"#{@bonus}",
"#{@total}"
]
@text_x = [386,386,386,386]
@text_y = [121,157,190,262]
texto = []
for i in 0..3
texto.push([_INTL("#{@info[i]}"),@text_x[i]-29,@text_y[i]-33,3,$color1,
$color1_s])
wait(2)
end
@sprites["score"].bitmap.font.size = 46*2
pbSetSystemFont(@sprites["score"].bitmap)
pbDrawTextPositions(@score_over,texto)
pbSEPlay("navopen")
10.times do
update
@sprites["score"].zoom_x += 0.1 ; @sprites["score"].zoom_y += 0.1
end
end
#----------------------------------------------------------------------------#
# ** Muestra la imagen de Record.
#----------------------------------------------------------------------------#
def call_high_score
@sprites["high"] = Sprite.new
@sprites["high"].bitmap = Bitmap.new("Graphics/WaE/Head It/New_Record")
@sprites["high"].ox = @sprites["high"].bitmap.width/2
@sprites["high"].oy = @sprites["high"].bitmap.height/2
@sprites["high"].x = @sprites["score"].bitmap.width/2 + 29
@sprites["high"].y = 262 + 80
@sprites["high"].zoom_x = 2.0
@sprites["high"].zoom_y = 2.0
@sprites["high"].opacity = 0
pbSEPlay("Absorb2")
10.times do
update
@sprites["high"].zoom_x -= 0.1
@sprites["high"].zoom_y -= 0.1
@sprites["high"].opacity += 25.5
@sprites["high"].angle += 36
end
end
#----------------------------------------------------------------------------#
# ** Anima el Logo de Record
#----------------------------------------------------------------------------#
def anim_record
5.times do
update
@sprites["high"].zoom_x += 0.05
@sprites["high"].zoom_y -= 0.05
if pbPressAnyKey or pbPressAnyMouse
return @breakable = true
end
end
if pbPressAnyKey or pbPressAnyMouse
return @breakable = true
end
5.times do
update
@sprites["high"].zoom_x -= 0.05
@sprites["high"].zoom_y += 0.05
if pbPressAnyKey or pbPressAnyMouse
return @breakable = true
end
end
end
#----------------------------------------------------------------------------#
# ** Destruye el Plano de Record
#----------------------------------------------------------------------------#
def clear_record
@sprites["high"].zoom_x = 1.0
@sprites["high"].zoom_y = 1.0
2.times do
update
end
5.times do
Graphics.update
@sprites["high"].zoom_y += 0.1
@sprites["high"].zoom_x -= 0.1
end
5.times do
Graphics.update
@sprites["high"].x += 200
end
end
#----------------------------------------------------------------------------#
# ** Anima el Plano de Puntuación
#----------------------------------------------------------------------------#
def anim_score
5.times do
update
@sprites["score"].angle -= 1
end
5.times do
update
@sprites["score"].angle += 1
end
end
#----------------------------------------------------------------------------#
# ** Destruye el Plano de Puntuación
#----------------------------------------------------------------------------#
def clear_score
5.times do
anim_score
end
10.times do
update
@sprites["score"].angle -= 1
end
wait(5)
pbSEPlay("Sleep")
20.times do
update
@sprites["score"].opacity -= 25.5/2
@sprites["score"].angle -= 1
@sprites["score"].y += 10
end
@sprites["score"].dispose
@score_over.clear
@score_screen.dispose
end
#----------------------------------------------------------------------------#
# ** Animación principal
#----------------------------------------------------------------------------#
def begin_animation
wait(5)
20.times do
Graphics.update
@sprites["bottom"].y += 21
@sprites["top"].y -= 21
end
wait(20)
10.times do
Graphics.update
@sprites["ready"].opacity += 25.5
@sprites["ready"].zoom_x -= 0.3 ; @sprites["ready"].zoom_y -= 0.3
end
10.times do
Graphics.update
@sprites["ready"].x += 3
wait(3)
@sprites["ready"].x -= 3
end
10.times do
Graphics.update
@sprites["ready"].opacity -= 25.5
@sprites["ready"].zoom_x -= 0.3 ; @sprites["ready"].zoom_y -= 0.3
end
wait(10)
10.times do
Graphics.update
@sprites["go"].opacity += 25.5
@sprites["go"].zoom_x -= 0.3 ; @sprites["go"].zoom_y -= 0.3
end
wait(15)
10.times do
Graphics.update
@sprites["go"].opacity -= 25.5
@sprites["go"].zoom_x += 0.3 ; @sprites["go"].zoom_y -= 0.3
end
@sprites["Pokémon"].visible = true
pbPlayCry($Trainer.party[@poke].species)
5.times do
Graphics.update
@sprites["Pokémon"].y -= 30
end
end
rescue
score_scene
wait(5)
if @score > $Trainer.head_it_record
call_high_score
end
loop do
update
@sprites["Pokémon"].update
@sprites["Pokémon"].x = $mouse.x
anim_record if @sprites["high"]
if @sprites["high"]
if @breakable == true
break
end
else
if pbPressAnyKey or pbPressAnyMouse
break
end
end
end
return
end
end
#==============================================================================#
# ** Inicia la escena
#==============================================================================#
class HeadButtGame
def initialize(scene)
@scene=scene
end
def pbStartScreen
@scene.pbStartScene
@scene.pbRunScene
@scene.pbEndScene
end
end
#==============================================================================#
# ** Método sencillo para llamar el minijuego
#==============================================================================#
def pbHeadIt
scene = HeadButtMinigame.new
screen = HeadButtGame.new(scene)
screen.pbStartScreen
end
#==============================================================================#