LOGIN
SEARCH
PROFILE
keys: ↑ ↓
LOGOUT
INDEX
MEMBERS
keys: ↑ ↓
HOME
PORTAL
PLAY ALONG
PLAY with WORDS
PLAY with GRAPHICS
PLAY with SOUNDS
PLAY with CODES
PLAY with PROJECTS
keys: ← →
Guest Access
Register:
Members:



View previous topic View next topic Go down Message [Page 1 of 1]

Administrator
Administrator
#1 default RMXP - Square_Circle_Cross
Loading

G@MeF@Ce

G@MeF@Ce
Administrator
Administrator
Administrator
profile


Before there was Rock, Paper and Scissors, there was an ancient game of...

SQUARE! CIRCLE! CROSS!


RMXP - Square_Circle_Cross Cc_scc10


I was in that mode to make what I thought was to be a very simple script, but it wasn't, nor could I help myself from 'over-thinking-it' if you code and know what I mean.

We all know the game, but to we really understand the conditions?

For starters you have three major endings: WIN, LOSE, or DRAW
Then you have certain outcomes comparing two results (one selected and another at random)
The player has three options after placing a bet
The script will randomize the numbers:one, two, or three.
The random number's value will be compared to the players option which is a value.
So to put it in simplest terms there's a total of 9 possible outcomes says no one who ever played Rock Paper Scissors. Instructions are in the script, customize the module to your liking and if you ever owned some Battle Beasts, I'll have a surprise for you in the near future.

Code:
#-----------------------------------------------------------------
# RMXP ■ Square-Circle-Cross □-O-X  v0.7 by G@MeF@Ce 2/23/21  
# Bet - Pick [paper - rock - scissors] Results
#-----------------------------------------------------------------
# further development: [ □-O-X ] pictures / animations / screen shake / flash
# credits to Slipnot for Guess Number script as code example
# thanks to mr_wiggles for script support
# special shout out to the makers of Battle Beasts!
#
# RMXP Instructions: (copy and paste script above main in script database)
#
# Run script with: $scene = G_Scc.new
#-----------------------------------------------------------------
module G101_SCC
  #font settings
  SCC_FONT = "Impact"
  #bet window settings
  BET_WIN_W = 120 #bet window width in pixels
  #set bet titles - set bet values at line 135
  BET1_VAL = "1 "
  BET2_VAL = "5 "
  BET3_VAL = "10 "
  EXIT_WORD = "No Bets"
  #Gold window
  GOLD_WORD = "bolts"
  GOLD_W = 160
  #choice words i.e. paper scissr rock
  G101_SCC::PICK_H = 128
  G101_SCC::PICK_W = 196
  PICK1 = "SQUARE"
  PICK2 = "CIRCLE"
  PICK3 = "CROSS"
  #3 frame picture
  #TRI_PIK = "tripik1"
end
#-----------------------------------------------------------------
# Create the Object
#-----------------------------------------------------------------
 class G_Scc #use a call script in event: $scene = G_Scc.new
#-----------------------------------------------------------------
   def initialize(menu_index = 0)
    @menu_index = menu_index
   end
#--------------------------------------------------------------------------
# The 'loop' that maintains the current Scene for the 'main' Thread.
#--------------------------------------------------------------------------
   def main
    @spriteset = Spriteset_Map.new #comment out to have black background
#Bet Window -------------------------------------------
    g = G101_SCC::GOLD_WORD
    b1 = G101_SCC::BET1_VAL
    b2 = G101_SCC::BET2_VAL
    b3 = G101_SCC::BET3_VAL
#set bet values
    s1= b1+g; s2=b2+g; s3=b3+g; s4=G101_SCC::EXIT_WORD
    @com = Window_Command.new(G101_SCC::BET_WIN_W,[s1,s2,s3,s4])
    @com.index = @menu_index; @com.x = 8; @com.y = 320-@com.height-8; betable
#Gold Window -------------------------------------------
    @gold = Window_Gold.new
    @gold.x = 320 -@gold.width/2 #center screen
    @gold.y = 480-@gold.height-8#at bottom
    @gold.width = G101_SCC::GOLD_W
#Option Window -----------------------------------------
    @optn1 = Optns.new
    @optn1.x = 320 - @optn1.width/2 #center screen
    @optn1.y = 240 - @optn1.height #below center screen
#Result Window -----------------------------------------
    @optn2 = Optns.new
    @optn2.x = 320 - @optn2.width/2 #center screen
    @optn2.y = 10#top center screen
#PICK Window -------------------------------------------
    c1=G101_SCC::PICK1; c2=G101_SCC::PICK2; c3=G101_SCC::PICK3 #only three choices
    @pick = Window_Command.new(180,[c1,c2,c3])#text command menu with
    showact(@pick,false)
    @pick.height= G101_SCC::PICK_H
    @pick.width = G101_SCC::PICK_W
    @pick.x = 320 - @pick.width/2
    @pick.y = @optn1.y+@optn1.height
#SET Window --------------------------------------------
    @slt = Select.new
    @slt.x = @pick.x
    @slt.y = @pick.y
#Execute transition from last $scene
    Graphics.transition
#main loop, this is what is done in Thread 'main' its the single proccess
    loop do
      Graphics.update; Input.update; update
      if $scene != self; break; end
    end
    Graphics.freeze; @spriteset.dispose
#clear this class Object's cached objects and sub items
    @com.dispose; @optn1.dispose; @optn2.dispose; @pick.dispose; @gold.dispose
   end #end main
#--------------------------------------------------------------------------
# What is called each frame that gets updated.
#--------------------------------------------------------------------------
    def update
     @com.update; @optn1.update; @optn2.update; @pick.update; @gold.update
      if @com.active; com_update; return; end
      if @pick.active; update_pick; return; end
    end
#--------------------------------------------------------------------------
# define the delay of the results
#--------------------------------------------------------------------------
    def flash(seconds)
      for i in 0...(seconds*1)
      sleep 0.01; Graphics.update
    end
   end
#-----------------------------------------------------------------
# bet if able and disable bet options if not enough gold/bolts
#-----------------------------------------------------------------
  def betable
    @com.refresh
    gold = $game_party.gold
    if gold < 1 ; @com.disable_item(0); @com.disable_item(1)
      @com.disable_item(2); @dec = 1
    elsif gold < 4; @com.disable_item(1)
      @com.disable_item(2); @dec = 2
    elsif gold < 9; @com.disable_item(2)
      @dec = 3
    else; @dec = 0; end
  end
#--------------------------------------------------------------------------
# toggle visibility
#--------------------------------------------------------------------------
  def showact(v,a)
    v.visible = a; v.active = a
  end
#-----------------------------------------------------------------
  def com_update
   # escape from scene return to scene map
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new; return
    end
   # set bet values
   if Input.trigger?(Input::C)
     case @com.index
     when 0
       if @dec == 1
         $game_system.se_play($data_system.buzzer_se); return
       end; @bet = 1; comon
     when 1
       if @dec == 2
         $game_system.se_play($data_system.buzzer_se); return
       end; @bet = 5; comon
     when 2
       if @dec == 2 or @dec == 3
         $game_system.se_play($data_system.buzzer_se); return
       end; @bet = 10; comon
     when 3; $scene = Scene_Map.new
     end; return
   end
end
#-----------------------------------------------------------------
def update_pick
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     showact(@pick,false)
     @optn1.visible = false; @com.active = true
   end
   if Input.trigger?(Input::C)
     case @pick.index
     when 0; pickshow#square aka paper
     when 1; pickshow#cirle aka rock
     when 2; pickshow#cross aka scissors
     end; return
   end
end
#-----------------------------------------------------------------
def comon #command on
   $game_system.se_play($data_system.decision_se)
   @com.active = false
   #player choise
   @opt1 = @pick.index #square = 0 circle = 1 cross = 2
   #computer random value
   @opt2 = rand(3) #will generate a random number 1, 2 0r 3
   @optn1.visible = false
   @optn1.comp(@opt1.to_s)#<======== draw random result
   showact(@pick,true)
end
#-----------------------------------------------------------------
def pickshow #show what you picked
   showact(@pick,false)
   @optn1.visible = false
   #@optn2.comp(@opt2.to_s)#<======== draw random result
   @optn2.visible = true
   #when player picks square
   if @pick.index == 0
      if @opt2 == 2; rslt(2);rslt2(0);@optn2.comp("CROSS")#computer cross player square lose
      elsif @opt2 == 1; rslt(0);rslt2(0);@optn2.comp("CIRCLE")#computer circle player square wins
      elsif @opt2 == 0; rslt(1);rslt2(0);@optn2.comp("SQUARE")#computer square player square draw
      end
   #when player picks circle
   elsif @pick.index == 1
      if @opt2 == 2; rslt(0);rslt2(1);@optn2.comp("CROSS")#computer cross player circle wins
      elsif @opt2 == 1; rslt(1);rslt2(1);@optn2.comp("CIRCLE")#computer circle player circle draw
      elsif @opt2 == 0; rslt(2);rslt2(1);@optn2.comp("SQUARE")#computer square player circle lose
      end
   #when player picks cross
   elsif @pick.index == 2
      if @opt2 == 2; rslt(1);rslt2(2);@optn2.comp("CROSS")#computer cross player cross draw
      elsif @opt2 == 1; rslt(2);rslt2(2);@optn2.comp("CIRCLE")#computer circle player cross lose
      elsif @opt2 == 0; rslt(0);rslt2(2);@optn2.comp("SQUARE")#computer square player cross wins
      end    
    end
   #show result
   @slt.visible = true
   #set delay
   betable; flash(80); @slt.visible = false
   @optn2.visible = false; @com.active = true
end
#-----------------------------------------------------------------
def rslt(a)#results
   case a
     when 0; @slt.plyr("YOU WIN!")
     #need message i.e. "Paper Beats Rock!"
     $game_party.gain_gold(@bet*2); @gold.refresh
     #switch win
     #happy sound
     when 1; @slt.plyr("IT'S A DRAW!")
     #message "Jinx!"
     #peaceful sound
     when 2; @slt.plyr("YOU LOSE")
     #need message "Rock can't handle paper"
     $game_party.lose_gold(@bet); @gold.refresh
     #switch lose
     #sad sound
   end
 end
#-----------------------------------------------------------------
 def rslt2(b)#show choice
   case b
   #take choice value and write it to display
     when 0; @slt.plyr2("SQUARE")
     when 1; @slt.plyr2("CIRCLE")
     when 2; @slt.plyr2("CROSS")
   end
 end
#-----------------------------------------------------------------
end
#==============================================================================
# Window Picture Results
#==============================================================================
class Optns < Window_Base
#-----------------------------------------------------------------
def initialize
   super(0,0,196,128)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = G101_SCC::SCC_FONT
   self.visible = false; self.contents.font.size = 36
   comp("")
end
#-----------------------------------------------------------------
def comp(txt)
   self.contents.clear; self.contents.draw_text(0,0,164,96,txt,1)
end
#-----------------------------------------------------------------
end
#==============================================================================
# Window Word Results
#==============================================================================
class Select < Window_Base
#-----------------------------------------------------------------
    def initialize
     super(0,0,196,128)
     self.contents = Bitmap.new(width - 32, height - 32)
     self.contents.font.name = G101_SCC::SCC_FONT
     self.visible = false; self.contents.font.size = 32
     plyr("")
     plyr2("")
    end
#-----------------------------------------------------------------
    def plyr(txt)
     self.contents.clear; self.contents.draw_text(0,0,164,136,txt,1)
    end
#-----------------------------------------------------------------
    def plyr2(txt2)
     self.contents.draw_text(0,0,164,56,txt2,1)
    end
#-----------------------------------------------------------------
end
#end of script ^,^

RMXP - Square_Circle_Cross G101_s10~enjoy! ^,^
Administrator
Show Signature


Hey Guest, check out my demos!
Super Mockup Project
Cool Puzzle Cave
Into the Nexas
Web_Plat
Getroid
G.A.S.




G101's theme colors
RMXP - Square_Circle_Cross G101_t10


RMXP - Square_Circle_Cross G101_c28


shhh.... secret project



My Portfolio Page
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr https://www.youtube.com/user/MrGameface101?feature=watch

View previous topic View next topic Back to top Message [Page 1 of 1]

 

Chatbox system disabled
Personal messaging disabled