LOG_IN

LOG_OUT
[connected]

Ruby/RGSS Lessons 5 5 19

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

#31 Re: Ruby/RGSS Lessons

handy333

Active Member
Active Member
||||||||||||||||
It's kind of hard to follow the vids when he's only using RMVX or higher. That's why I'm sort of confused on all of the topics.

Noob, nerd, or geek aren't a set of my favorite words...
handy333's signature


http://www.facebook.com/handy.fox http://soundcloud.com/handyfox http://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w http://projectrisingsun.weebly.com/
#32 Re: Ruby/RGSS Lessons

G@MeF@Ce

Administrator
CD3DF5

Administrator CD3DF5
||||||||||||||||
what vids are you talking about?


is there a script that you are currently using, editing, trying to make?

maybe we can break down a few lines with comments to understand/learn some more... ?
G@MeF@Ce's 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






http://g4m3f4c3.deviantart.com http://twitter.com/#!/mr_gameface101 http://www.facebook.com/mrgameface101 http://soundcloud.com/mr_gameface101 http://www.youtube.com/user/MrGameface101?feature=watch
#33 Re: Ruby/RGSS Lessons

handy333

Active Member
Active Member
||||||||||||||||
I'm working on a padlock system for my one of my training project games here's the code:

Code:
class Pad
   def initialize(com, angle = 0)
       $angle = angle
      @com = com
       @times = -1
       @combo = []
       @close = false
       main
   end
   
   def main
      @show = Viewport.new(0, 0, 640, 480)
      @show.z = 3
      
      @back = Sprite.new(@show)
      @back.bitmap = RPG::Cache.picture("Lock-back")
      @back.x = 87
      @back.y = 7
      @mid= Sprite.new(@show)
      @mid.bitmap = RPG::Cache.picture("Lock-Dial")
      @mid.x = 320
      @mid.y = 240
    @mid.ox = 150.5
    @mid.oy = 152
      @glint = Sprite.new(@show)
      @glint.bitmap = RPG::Cache.picture("Lock-Glint")
      @glint.x = 319
      @glint.y = 176
    @glint.opacity = 150
   
    @stats_window = Results.new
    @stats_window.back_opacity = 130
      
       # Main loop
      loop do
          # Update game screen
          Graphics.update
          # Update input information
         Input.update
          # Frame update
         update
         # Abort loop if screen is changed
          if @close == true
            break
         end
    end
   
    @back.dispose
    @mid.dispose
    @glint.dispose
    @stats_window.dispose
   end
   
   def update
      @back.update
      @mid.update
      @glint.update     
      if Input.press?(Input::LEFT)
      $angle = @mid.angle += 1.to_i
      Audio.se_play("Audio/SE/032-Switch01", 70, 0) rescue nil
     
      if @mid.angle >= 1
        @mid.angle = 0
        Audio.se_stop       
      end
    end
   
      if Input.press?(Input::RIGHT)
      $angle = @mid.angle += -1.to_i
      Audio.se_play("Audio/SE/032-Switch01", 70, 0) rescue nil
     
     
      if @mid.angle <= -319
        @mid.angle = -318
        Audio.se_stop       
      end 
      end
   
    if Input.trigger?(Input::R)
      $angle = @mid.angle += -50
      Audio.se_play("Audio/SE/032-Switch01", 70, 0) rescue nil
      if @mid.angle <= -318
        @mid.angle = -318
        $angle = -318
      end
    end
   
    if Input.trigger?(Input::L)
      @angle = @mid.angle += 50
      Audio.se_play("Audio/SE/032-Switch01", 70, 0) rescue nil
      if @mid.angle >= 1
        @mid.angle = 0
        @angle = 0
      end     
    end
 
      if Input.trigger?(Input::B)
         @back.dispose
         @mid.dispose
         @glint.dispose
      @close = true
      end
   
    if Input.trigger?(Input::C)
      p @angle
      ini = @angle.to_a
      @times += 1   
      if @times == 2
        @times = 0
        if @com == @combo
          p "Got it!"
          Audio.se_play("Audio/SE/054-Right01", 70, -100) rescue nil
          @back.dispose
          @mid.dispose
          @glint.dispose
          @close = true
        else
          Audio.se_play("Audio/SE/057-Wrong01", 70, -100) rescue nil
          @combo.clear
        end

      end
      case @times
      when 0
        @combo += ini
        p @combo
      when 1
        @combo += ini
        p @combo       
      when 2
        @combo += ini
        p @combo       
      end
      end
   end
end


class Results < Window_Base
  def initialize
    super(0, 0, 130, 130)
    self.contents = Bitmap.new(width - 32, height - 32) 
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 130, 130,"")
  end
end


There are probably millions of things wrong with this but I got what I needed to work, now what I'm trying to do is make the coordinates display on a window so the player could see what they inputed.
handy333's signature


http://www.facebook.com/handy.fox http://soundcloud.com/handyfox http://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w http://projectrisingsun.weebly.com/

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

 

Chatbox system disabled
Personal messaging disabled