1 Sistema de Pedra Papel Tesoura Qua 14 Nov 2012, 04:08
Carlos
Administrador
Introdução:
Esse script e bem simples, ele tem o jogo de jokenpo, aquele famoso jogo de pedra papel e tesoura.
Instruções:
Suas instruções são simples.
Na linha 29 onde está "PPT_Fundo" você pode digitar o nome da imagem de fundo para dar um efeito melhor. (A imagem deve ficar na pasta pictures.
Na linha 30 onde está "PPT_Fundo_Opacidade" você pode definir a opacidade da imagem de fundo.
Na linha 34 você defini a switch quando ganha
Na linha 35 você defini a switch quando perde
Na linha 36 você defini a switch quando empata
Demo:
DOWNLOAD
Screenshots:
[Tens de ter uma conta e sessão iniciada para poderes visualizar esta imagem]
Cole as imagens na pasta Pictures:
[Tens de ter uma conta e sessão iniciada para poderes visualizar esta imagem]
Script:
Créditos:
Por Master I
Esse script e bem simples, ele tem o jogo de jokenpo, aquele famoso jogo de pedra papel e tesoura.
Instruções:
Suas instruções são simples.
Na linha 29 onde está "PPT_Fundo" você pode digitar o nome da imagem de fundo para dar um efeito melhor. (A imagem deve ficar na pasta pictures.
Na linha 30 onde está "PPT_Fundo_Opacidade" você pode definir a opacidade da imagem de fundo.
Na linha 34 você defini a switch quando ganha
Na linha 35 você defini a switch quando perde
Na linha 36 você defini a switch quando empata
Demo:
DOWNLOAD
Screenshots:
[Tens de ter uma conta e sessão iniciada para poderes visualizar esta imagem]
Cole as imagens na pasta Pictures:
[Tens de ter uma conta e sessão iniciada para poderes visualizar esta imagem]
Script:
- Código:
#===============================================================================
#===============================================================================
#===============================================================================
#=================Sistema (Pedra, Papel, Tesoura)===============================
#===============================================================================
#===============================================================================
#========================by: Master I===========================================
#===============================================================================
#===============================================================================
#===============================================================================
#Para chamar a Scene.
#-------------------------------------------------------------------------------
########################
#$scene = Scene_PPT.new#
########################
module Pernalonga
###############
#Configurações#
###############
#===============================================================================
#Nome das imagens.
#-------------------------------------------------------------------------------
Pedra = "Pedra" #Nome da imagem pedra
Papel = "Papel" #Nome da imagem papel
Tesoura = "Tesoura" #Nome da imagem tesoura
PPT_Cursor = "Cursor" #Nome da imagem do cursor
PPT_Fundo = "" #Imagem de Fundo
PPT_Fundo_Opacidade = 0 #Opacidade do Fundo
#===============================================================================
#Identificação das Switches.
#-------------------------------------------------------------------------------
PPT_Switch = 1 # ID da switch quando ganha
PPT_Switch_lose = 2 # ID da switch quando perde
PPT_Switch_emp = 3 # ID da switch quando empata
end
#######################
#Fim das Configurações#
#######################
#===============================================================================
#Scene PPT (Pedra, Papel, Tesoura)
#-------------------------------------------------------------------------------
class Scene_PPT < Scene_Base
def start
create_menu_background
command_window
@cursor = Sprite.new
@cursor.bitmap = Cache.picture(Pernalonga::PPT_Cursor)
@cursor.x = 99
@cursor.y = 300
@contador = 0
@ppt_npc = rand(3)
@pedra = Sprite.new
@papel = Sprite.new
@tesoura = Sprite.new
@pedra.bitmap = Cache.picture(Pernalonga::Pedra)
@papel.bitmap = Cache.picture(Pernalonga::Papel)
@tesoura.bitmap = Cache.picture(Pernalonga::Tesoura)
@tesoura.z = 2
@pedra.z = 2
@papel.z = 2
@pedra.x = 100
@papel.x = 250
@tesoura.x = 400
@pedra.y = 300
@papel.y = 300
@tesoura.y = 300
@cursor.z = 3
@pedra_npc = Sprite.new
@papel_npc = Sprite.new
@tesoura_npc = Sprite.new
@pedra_npc.bitmap = Cache.picture(Pernalonga::Pedra)
@papel_npc.bitmap = Cache.picture(Pernalonga::Papel)
@tesoura_npc.bitmap = Cache.picture(Pernalonga::Tesoura)
@pedra_npc.z = 2
@papel_npc.z = 2
@tesoura_npc.z = 2
@pedra_npc.x = 250
@papel_npc.x = 250
@tesoura_npc.x = 250
@pedra_npc.y = - 50
@papel_npc.y = - 50
@tesoura_npc.y = - 50
@fundo_ppt = Sprite.new
@fundo_ppt.bitmap = Cache.picture(Pernalonga::PPT_Fundo)
@fundo_ppt.z = 1
@fundo_ppt.opacity = Pernalonga::PPT_Fundo_Opacidade
end
def update
command_window
end
def terminate
Graphics.wait(40)
@pedra.dispose
@papel.dispose
@tesoura.dispose
@cursor.dispose
@pedra_npc.dispose
@tesoura_npc.dispose
@papel_npc.dispose
@fundo_ppt.dispose
end
def command_window
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::RIGHT)
Sound.play_cursor
@contador += 1
if @contador == 1
@cursor.x = 250
elsif @contador == 2
@cursor.x = 400
elsif @contador >= 2
@contador = 2
end
elsif Input.trigger?(Input::LEFT)
Sound.play_cursor
@contador -= 1
if @contador == 1
@cursor.x = 250
elsif @contador == 0
@cursor.x = 99
elsif @contador <= - 1
@contador = 0
end
elsif Input.trigger?(Input::C)
Sound.play_decision
@cursor.visible = false
definição_ppt
definição_ppt_npc
case @contador
when 0
Graphics.wait(5)
@papel.y += 25
@tesoura.y += 25
@pedra.x += 25
@pedra.y -= 25
Graphics.wait(5)
@papel.y += 25
@tesoura.y += 25
@pedra.x += 25
@pedra.y -= 25
Graphics.wait(5)
@papel.y += 25
@tesoura.y += 25
@pedra.x += 25
@pedra.y -= 25
Graphics.wait(5)
@papel.y += 25
@tesoura.y += 25
@pedra.x += 25
@pedra.y -= 25
Graphics.wait(5)
@papel.y += 25
@tesoura.y += 25
@pedra.x += 25
@pedra.y -= 25
Graphics.wait(5)
@papel.y += 25
@tesoura.y += 25
@pedra.x += 25
@pedra.y -= 25
Graphics.wait(10)
when 1
Graphics.wait(5)
@pedra.y += 25
@tesoura.y += 25
@papel.y -= 25
Graphics.wait(5)
@pedra.y += 25
@tesoura.y += 25
@papel.y -= 25
Graphics.wait(5)
@pedra.y += 25
@tesoura.y += 25
@papel.y -= 25
Graphics.wait(5)
@pedra.y += 25
@tesoura.y += 25
@papel.y -= 25
Graphics.wait(5)
@pedra.y += 25
@tesoura.y += 25
@papel.y -= 25
Graphics.wait(5)
@pedra.y += 25
@tesoura.y += 25
@papel.y -= 25
Graphics.wait(10)
when 2
Graphics.wait(5)
@pedra.y += 25
@papel.y += 25
@tesoura.y -= 25
@tesoura.x -= 25
Graphics.wait(5)
@pedra.y += 25
@papel.y += 25
@tesoura.y -= 25
@tesoura.x -= 25
Graphics.wait(5)
@pedra.y += 25
@papel.y += 25
@tesoura.y -= 25
@tesoura.x -= 25
Graphics.wait(5)
@pedra.y += 25
@papel.y += 25
@tesoura.y -= 25
@tesoura.x -= 25
Graphics.wait(5)
@pedra.y += 25
@papel.y += 25
@tesoura.y -= 25
@tesoura.x -= 25
Graphics.wait(5)
@pedra.y += 25
@papel.y += 25
@tesoura.y -= 25
@tesoura.x -= 25
Graphics.wait(10)
end
end
end
def definição_ppt_npc
case @ppt_npc
when 0
Graphics.wait(5)
@pedra_npc.y += 25
Graphics.wait(5)
@pedra_npc.y += 25
Graphics.wait(5)
@pedra_npc.y += 25
Graphics.wait(5)
@pedra_npc.y += 25
Graphics.wait(5)
@pedra_npc.y += 25
Graphics.wait(10)
when 1
Graphics.wait(5)
@papel_npc.y += 25
Graphics.wait(5)
@papel_npc.y += 25
Graphics.wait(5)
@papel_npc.y += 25
Graphics.wait(5)
@papel_npc.y += 25
Graphics.wait(5)
@papel_npc.y += 25
Graphics.wait(10)
when 2
Graphics.wait(5)
@tesoura_npc.y += 25
Graphics.wait(5)
@tesoura_npc.y += 25
Graphics.wait(5)
@tesoura_npc.y += 25
Graphics.wait(5)
@tesoura_npc.y += 25
Graphics.wait(5)
@tesoura_npc.y += 25
Graphics.wait(10)
end
end
def definição_ppt
if @ppt_npc == @contador
#empata
$game_switches[Pernalonga::PPT_Switch_emp] = true
$game_switches[Pernalonga::PPT_Switch] = false
$game_switches[Pernalonga::PPT_Switch_lose] = false
elsif @contador == 2 and @ppt_npc == 1
#ganha
$game_switches[Pernalonga::PPT_Switch] = true
$game_switches[Pernalonga::PPT_Switch_emp] = false
$game_switches[Pernalonga::PPT_Switch_lose] = false
elsif @contador == 2 and @ppt_npc == 0
#perde
$game_switches[Pernalonga::PPT_Switch_lose] = true
$game_switches[Pernalonga::PPT_Switch_emp] = false
$game_switches[Pernalonga::PPT_Switch] = false
elsif @contador == 0 and @ppt_npc == 2
#ganha
$game_switches[Pernalonga::PPT_Switch] = true
$game_switches[Pernalonga::PPT_Switch_emp] = false
$game_switches[Pernalonga::PPT_Switch_lose] = false
elsif @contador == 0 and @ppt_npc == 1
#perde
$game_switches[Pernalonga::PPT_Switch_lose] = true
$game_switches[Pernalonga::PPT_Switch_emp] = false
$game_switches[Pernalonga::PPT_Switch] = false
elsif @contador == 1 and @ppt_npc == 0
#ganha
$game_switches[Pernalonga::PPT_Switch] = true
$game_switches[Pernalonga::PPT_Switch_emp] = false
$game_switches[Pernalonga::PPT_Switch_lose] = false
elsif @contador == 1 and @ppt_npc == 2
#perde
$game_switches[Pernalonga::PPT_Switch_lose] = true
$game_switches[Pernalonga::PPT_Switch_emp] = false
$game_switches[Pernalonga::PPT_Switch] = false
end
$scene = Scene_Map.new
end
end
Créditos:
Por Master I
Última edição por ChaCauL em Qui 15 Nov 2012, 00:46, editado 2 vez(es)