2 Arcade minigame

● ARCHIVED · READ-ONLY
Started by Zarby 14 posts View original ↗
  1. 2 Arcade minigame i've made some day ago,i was planning doing more games but i don't know.
     
    Here a video :
    https://www.youtube.com/watch?v=JQSg2LkfJhg
     
    Here the scripts :
     
    Images Creations for numbers and class modifying (Needed to run the 2 other script)

    Spoiler
    Code:
    #==============================================================================# ** Game_Images#------------------------------------------------------------------------------#  This Module handles Image Creations. #==============================================================================module Game_Images  #--------------------------------------------------------------------------  # * Numbers  #--------------------------------------------------------------------------  def self.zero    b = Bitmap.new(6,12)    b.fill_rect(b.rect, Color.new(255,255,255))    b.clear_rect(2,2,2,8)    return b  end  def self.one    b = Bitmap.new(6,12)    b.fill_rect(4,0,5,12, Color.new(255,255,255))    return b  end  def self.two    b = Bitmap.new(6,12)    b.fill_rect(b.rect, Color.new(255,255,255))    b.clear_rect(0,2,4,3)    b.clear_rect(2,7,4,3)    return b  end  def self.three    b = Bitmap.new(6,12)    b.fill_rect(b.rect, Color.new(255,255,255))    b.clear_rect(0,2,4,3)    b.clear_rect(0,7,4,3)    return b  end  def self.four    b = Bitmap.new(6,12)    b.fill_rect(b.rect, Color.new(255,255,255))    b.clear_rect(2,0,2,5)    b.clear_rect(0,7,4,5)    return b  end  def self.five    b = Bitmap.new(6,12)    b.fill_rect(b.rect, Color.new(255,255,255))    b.clear_rect(2,2,4,3)    b.clear_rect(0,7,4,3)    return b  end  def self.six    b = Bitmap.new(6,12)    b.fill_rect(b.rect, Color.new(255,255,255))    b.clear_rect(2,0,5,5)    b.clear_rect(2,7,2,3)    return b  end  def self.seven    b = Bitmap.new(6,12)    b.fill_rect(b.rect, Color.new(255,255,255))    b.clear_rect(0,2,4,10)    return b  end  def self.eight    b = Bitmap.new(6,12)    b.fill_rect(b.rect, Color.new(255,255,255))    b.clear_rect(2,2,2,3)    b.clear_rect(2,7,2,3)    return b  end  def self.nine    b = Bitmap.new(6,12)    b.fill_rect(b.rect, Color.new(255,255,255))    b.clear_rect(2,2,2,3)    b.clear_rect(0,7,4,5)    return b  end  def self.nbrstripe    b = Bitmap.new(60,12)    bb = self.zero    b.blt(0, 0,bb ,bb.rect)    bb = self.one    b.blt(6, 0,bb ,bb.rect)    bb = self.two    b.blt(12, 0,bb ,bb.rect)    bb = self.three    b.blt(18, 0,bb ,bb.rect)    bb = self.four    b.blt(24, 0,bb ,bb.rect)    bb = self.five    b.blt(30, 0,bb ,bb.rect)    bb = self.six    b.blt(36, 0,bb ,bb.rect)    bb = self.seven    b.blt(42, 0,bb ,bb.rect)    bb = self.eight    b.blt(48, 0,bb ,bb.rect)    bb = self.nine    b.blt(54, 0,bb ,bb.rect)    return b  end    end#==============================================================================# ** Bitmap Class#------------------------------------------------------------------------------#  Modify the Bitmap class to draw our new number#==============================================================================class Bitmap  def draw_custom_text(text,x,y)    b = Game_Images.nbrstripe    for i in 0..text.size-1      if (text[i].ord >= 48 && text[i].ord <= 57)        blt(x+(i*7), y, b, Rect.new((text[i].ord-48)*6,0,6,12))       end    end  endend#==============================================================================# ** Sprite Class#------------------------------------------------------------------------------#  Modify the Bitmap class to add Bounding Box method#==============================================================================class Sprite  def boundingbox()    return Rect.new(x,y,src_rect.width,src_rect.height)  endend
     
    Pong
    Spoiler
    Code:
    #==============================================================================#Pong V0.1#Author : Zarby - No Credit Required, free to use#Rule first to score 10 point win#==============================================================================#==============================================================================# ** Game_Images#------------------------------------------------------------------------------#  This Module handles Image Creations. #==============================================================================module Game_Images  #--------------------------------------------------------------------------  # * Paddle Image  #--------------------------------------------------------------------------  def self.paddle    b = Bitmap.new(8,32)    b.fill_rect(b.rect, Color.new(255,255,255))    return b  end  #--------------------------------------------------------------------------  # * Ball Image  #--------------------------------------------------------------------------  def self.ball    b = Bitmap.new(8,8)    b.fill_rect(b.rect, Color.new(255,255,255))    return b  end  end#==============================================================================# ** Scene_Pong#------------------------------------------------------------------------------#  This Class perform the game processing "Pong"#==============================================================================class Scene_Pong < Scene_Base  #--------------------------------------------------------------------------  #DIFFICULTY SETTING  Difficulty = 15  #12 = Very Easy,14 = Easy, 16 = Hard, 18 = Very Hard, 20 Impossible  #0 = AI wont move at all, 10 = AI Move 1 on 2, 20 = AI Follow the ball  #VARIABLE RETURN IF WIN OR NOT  ReturnVariable = 10  #IF we win the variable will = 1, if we loose variable = 0 / -1 if leave  #--------------------------------------------------------------------------    #--------------------------------------------------------------------------  # * Start Processing  #--------------------------------------------------------------------------  def start    super    set_score    add_sprite    reset_ball    @ai_move = 0    @ai_timer = 0    @pause = false  end    def add_sprite    @player_paddle = Sprite.new()    @cpu_paddle = Sprite.new()    @ball = Sprite.new()    @player_paddle.bitmap = Game_Images.paddle    @cpu_paddle.bitmap = Game_Images.paddle    @ball.bitmap = Game_Images.ball    @player_paddle.x = 16    @player_paddle.y = 220    @cpu_paddle.x = 520    @cpu_paddle.y = 220    @ball.x = 268    @ball.y = 204    @scorep1_spr = Sprite.new()    b = Bitmap.new(24,12)    b.draw_custom_text(sprintf('%02d',@scorep1),0,0)    @scorep1_spr.bitmap = b    @scorep1_spr.zoom_x = 2    @scorep1_spr.zoom_y = 2    @scorep1_spr.x = 120    @scorep1_spr.y = 8    @scorep2_spr = Sprite.new()    b = Bitmap.new(24,12)    b.draw_custom_text(sprintf('%02d',@scorep2),0,0)    @scorep2_spr.bitmap = b    @scorep2_spr.zoom_x = 2    @scorep2_spr.zoom_y = 2    @scorep2_spr.x = 544-120    @scorep2_spr.y = 8    @timer_spr = Sprite.new()    @timer_spr.x = 260  end    def set_score    @scorep1 = 0    @scorep2 = 0  end    def reset_ball    @timer = 3    @bugtimer = 0    @real_timer = 120    @started = false    @ball_speed = 4    @real_ball_x = 268.0    @real_ball_y = 204.0    @ball.x = @real_ball_x    @ball.y = @real_ball_y    @ball_direction = 0    update_score  end    def update_score    b = Bitmap.new(24,12)    b.draw_custom_text(sprintf('%02d',@scorep2),0,0)    @scorep2_spr.bitmap = b    b = Bitmap.new(24,12)    b.draw_custom_text(sprintf('%02d',@scorep1),0,0)    @scorep1_spr.bitmap = b  end    def update_timer    if (@real_timer >= 0)      @timer_spr.visible = true      @real_timer -=1      @timer = @real_timer / 30      b = Bitmap.new(24,12)      b.draw_custom_text(sprintf('%02d',@timer),0,0)      @timer_spr.bitmap = b      if (@real_timer == 0)        @real_timer = -1        @timer = -1        game_start        @timer_spr.visible = false      end    end  end    def game_start    #Set ball direction    rand = Random.new()    @ball_side_x = rand.rand(0..1).to_i    @ball_side_y = rand.rand(0..1).to_i    @started = true    @ball_direction = rand.rand(-70..70)  end  def update    super    if (@pause == false)      update_timer      if (@started)        if (@ball_side_x == 1)          @real_ball_x += @ball_speed * Math.cos(degtorad(@ball_direction));        elsif (@ball_side_x == 0)          @real_ball_x -= @ball_speed * Math.cos(degtorad(@ball_direction));        end        if (@ball_side_y == 1)          @real_ball_y += @ball_speed * Math.sin(degtorad(@ball_direction));        elsif (@ball_side_y == 0)          @real_ball_y -= @ball_speed * Math.sin(degtorad(@ball_direction));        end              @ball.x = @real_ball_x        @ball.y = @real_ball_y      end          #Bug Solver?      if (@ball.y == 4)        @bugtimer+=1        if (@bugtimer >= 160)          reset_ball        end      else        @bugtimer = 0      end              player_control      check_collision      ai_control # Stupid AI     end    if (Input.trigger?(:X))      if (@pause == false)        @pause = true      elsif(@pause == true)        @pause = false      end    end        if (@scorep1 >= 10)      $game_variables[ReturnVariable] = 1      dispose    end    if (@scorep2 >= 10)      $game_variables[ReturnVariable] = 0      dispose    end        if (Input.press?(:)      $game_variables[ReturnVariable] = -1      dispose      end  end    def dispose    @player_paddle.dispose    @cpu_paddle.dispose    @scorep1_spr.dispose    @scorep2_spr.dispose    @timer_spr.dispose    #return_scene    SceneManager.goto(Scene_Map)  end    #-----------------------------------------------------------------------------  # Control if the player is pressing a key  #-----------------------------------------------------------------------------  def player_control    if (Input.press?(:UP))      @player_paddle.y -=4      if (@player_paddle.y < 0)        @player_paddle.y = 0      end    end    if (Input.press?(:DOWN))      @player_paddle.y +=4      if (@player_paddle.y > 416-32)        @player_paddle.y = 416-32      end    end  end      def ai_control    @ai_timer += 1    rand = Random.new()        if (@ai_timer >= 10)      @ai_move = rand.rand(0..20)#Rand if move < 10, else > 10      @ai_timer = 0    end        if (@ai_move < Difficulty)      if (@ball_side_x ==1)              if (@ball.y+2 < @cpu_paddle.y+16)          @cpu_paddle.y-=4        end              if (@ball.y+2 > @cpu_paddle.y+16)          @cpu_paddle.y+=4        end              if (@cpu_paddle.y < 0)          @cpu_paddle.y = 0        end        if (@cpu_paddle.y > 416-32)          @cpu_paddle.y = 416-32        end              end    end  end    #-----------------------------------------------------------------------------  # Check Collison between ball and wall, paddle  #-----------------------------------------------------------------------------  def check_collision    if (@ball.y <= 0)      @ball.y = @ball_speed      if (@ball_side_y == 0)        @ball_side_y = 1      elsif (@ball_side_y == 1)        @ball_side_y = 0      end    end        if (@ball.y >= 412)      @ball.y = 412 - @ball_speed      if (@ball_side_y == 0)        @ball_side_y = 1      elsif (@ball_side_y == 1)        @ball_side_y = 0      end    end        if (@ball.x >= 540)      @scorep1+=1      reset_ball    end    if (@ball.x <= 0)      @scorep2+=1      reset_ball    end    if (rectangle_intersect(@ball.boundingbox,@player_paddle.boundingbox) == true)      @ball.x = (@player_paddle.x + 4 + @ball_speed)      @ball_side_x = 1      @ball_direction = (-50 + ((@ball.y+2)-@player_paddle.y)*4)      if ((@ball.y+4)-@player_paddle.y) < 16        @ball_side_y = 1      end      if ((@ball.y+4)-@player_paddle.y) > 16        @ball_side_y = 1      end    end        if (rectangle_intersect(@ball.boundingbox,@cpu_paddle.boundingbox) == true)      @ball.x = (@cpu_paddle.x - 4 - @ball_speed)      @ball_side_x = 0      @ball_direction = (-50 + ((@ball.y+2)-@cpu_paddle.y)*4)      if ((@ball.y+4)-@cpu_paddle.y) < 16        @ball_side_y = 1      end      if ((@ball.y+4)-@cpu_paddle.y) > 16        @ball_side_y = 1      end    end      end    #-----------------------------------------------------------------------------  # If 2 rectangle interset return true  #-----------------------------------------------------------------------------  def rectangle_intersect(r1,r2)    if ((r1.x+r1.width > r2.x) && (r1.x < r2.x+r2.width) &&       (r1.y+r1.height > r2.y) && (r1.y < r2.y+r2.height))      return true    end    return false  end    def degtorad(deg)    return (deg * Math::PI / 180)  end  end
     
    Space Explorer
    Spoiler
    Code:
    #==============================================================================#SpaceExplorer V0.1#Author : Zarby - No Credit Required, free to use#Go the furthest you can !#==============================================================================#==============================================================================# ** Game_Images#------------------------------------------------------------------------------#  This Module handles Image Creations. #==============================================================================module Game_Images  #--------------------------------------------------------------------------  # * Paddle Image  #--------------------------------------------------------------------------  def self.spaceship    b = Bitmap.new(16,8)    b.fill_rect(1,1,3,1, Color.new(255,255,255))    b.fill_rect(5,1,2,1, Color.new(255,255,255))    b.fill_rect(7,0,2,2, Color.new(255,255,255))    b.fill_rect(9,0,2,1, Color.new(255,255,255))    b.fill_rect(11,1,2,1, Color.new(255,255,255))    b.fill_rect(13,2,1,1, Color.new(255,255,255))    b.fill_rect(14,3,1,3, Color.new(255,255,255))    b.fill_rect(4,5,10,2, Color.new(255,255,255))    b.fill_rect(2,2,8,4, Color.new(255,255,255))    b.fill_rect(6,4,5,4, Color.new(255,255,255))    b.fill_rect(1,3,1,1, Color.new(255,255,255))    b.fill_rect(1,5,1,1, Color.new(255,255,255))    return b  end  #272x208 x2end#==============================================================================# ** Scene_SpaceExplorer#------------------------------------------------------------------------------#  This Class perform the game processing "SpaceExplorer"#==============================================================================class Scene_SpaceExplorer < Scene_Base  #--------------------------------------------------------------------------  #SETTINGS  ReturnVariable = 10  #Return the score to the variable  #--------------------------------------------------------------------------    #--------------------------------------------------------------------------  # * Start Processing  #--------------------------------------------------------------------------  def start    super    @map = []    @space_between = 32    create_map    create_sprites    @score = 0    @lastvalue = 104    @lastdirectiontimer = 0    @lastdirection = 0    @scoretimer = 0    @deadtimer = 0    @pause = false    @dead = false  end    def create_sprites    @spaceship_spr = Sprite.new()    b = Bitmap.new(32,16)    b.stretch_blt(Rect.new(0,0,32,16), Game_Images.spaceship, Rect.new(0,0,16,8))     @bgr_bitmap = Bitmap.new(288,208)    @bgr_spr = Sprite.new()    @spaceship_spr.bitmap = b    @spaceship_spr.x = 16*2    @spaceship_spr.y = 104*2    @sprite_score = Sprite.new    @sprite_score.x = 544/2-(5*7)    @sprite_score.y = 400    update_image  end  #--------------------------------------------------------------------------  # * Update Processing  #--------------------------------------------------------------------------  def update    super    if (@pause == false)      @bgr_spr.x-=4;      @scoretimer+=1      if (@scoretimer >= 15)        @score+=1        @scoretimer = 0        b = Bitmap.new(64,16)        b.fill_rect(0,0,64,16,Color.new(0,0,0))        b.draw_custom_text(sprintf('%08d',@score),4,2)        @sprite_score.bitmap = b      end          if ((@spaceship_spr.y / 2) <= (@map[2]-@space_between))        @pause = true        @dead = true      end      if ((@spaceship_spr.y / 2) <= (@map[3]-@space_between))        @pause = true        @dead = true      end          if ((@spaceship_spr.y / 2)+8 >= (@map[2]+@space_between))        @pause = true        @dead = true      end      if ((@spaceship_spr.y / 2)+8 >= (@map[3]+@space_between))        @pause = true        @dead = true      end            if (@bgr_spr.x <=-16)        update_map        update_image        @bgr_spr.x = 0      end      player_control    else      if (@dead == true)        @deadtimer +=1        if (@deadtimer == 120)          dispose        end      end    end        if (Input.trigger?(:X))      if (@pause == false)        @pause = true      elsif(@pause == true)        @pause = false      end    end          end#update end    def create_map    m = 0    for i in 0..36      @map[i] = 104    end  end    def dispose    $game_variables[ReturnVariable] = @score    @bgr_spr.dispose    @spaceship_spr.dispose    @sprite_score.dispose    SceneManager.goto(Scene_Map)  end    def update_map    @space_between = 32    @lastdirectiontimer+=1    rand = Random.new()    if (@lastdirectiontimer >=rand.rand(0..3))            a = rand.rand(-1..1)      @lastdirection = 0      if (a == -1)        if (@lastvalue >= @space_between+8)          @lastvalue-=4;          @lastdirection = -1        else          @lastdirection = 1        end               end      if (a == 1)        if (@lastvalue <= 180-@space_between)          @lastvalue+=4;          @lastdirection = 1        else          @lastdirection = -1        end      end        @lastdirectiontimer = 0    end    r = rand.rand(0..100)        if (@lastdirection == -1)      @lastvalue-=4      if (r >= 75)        @lastvalue-=4      end    end    if (@lastdirection == 1)      @lastvalue+=4      if (r >= 75)        @lastvalue+=4      end    end                oldmap = @map    for i in 0..36      if (i != 36)        @map[i] = oldmap[i+1]      else        @map[i] = @lastvalue      end    end      end      #-----------------------------------------------------------------------------  # Control if the player is pressing a key  #-----------------------------------------------------------------------------  def player_control    if (Input.press?(:UP))      @spaceship_spr.y -=2      if (@spaceship_spr.y < 0)        @spaceship_spr.y = 0      end    end    if (Input.press?(:DOWN))      @spaceship_spr.y +=2      if (@spaceship_spr.y > 416-8)        @spaceship_spr.y = 416-8      end    end  end      def update_image    @bgr_bitmap = Bitmap.new(288,208)    for i in 0..36      mn = (@map[i]-@space_between)      mp = (@map[i]+@space_between)      @bgr_bitmap.fill_rect(i*8,0,8,mn,Color.new(132,68,20))      @bgr_bitmap.fill_rect(i*8,mp,8,288-mp,Color.new(132,68,20))         end    stretchedbmp = Bitmap.new(576,416)    stretchedbmp.stretch_blt(Rect.new(0,0,576,416), @bgr_bitmap, Rect.new(0,0,288,208))     @bgr_spr.bitmap = stretchedbmp  end    end
  2. Hello Zarby, Space Explorer arcade minigame has an undefined varible. It is draw_custom_text. It is located at line 94 in your script. I have tested it without the text, and it works, but the score would be nice to have. Thank you for the script and posting it on the rpg maker scripting forum. I would love to see you make more arcade minigames. I plan to use them in my non-commercial game as secrets that the players can find hidden around the game world.
  3. You need the script within the 1st spoiler to be installed in your project too, not just the "Pong" and "Space Explorer" scripts.


    'draw_custom_text' is defined in that script, so install it and it will work.


    Btw, nice little mini-games, Zarby!
  4. *face palm* Sorry that was my mistake for not seeing the 1st spoiler. Thank you Sixth, and also thank you Zarby for scripting awesome mini-games.
  5. What are the script calls for these minigames?
  6. Use:

    SceneManager.call(Scene_SpaceExplorer) for the Space minigame

    and

    SceneManager.call(Scene_Pong) for the Pong Minigame.

    btw:

    Nice Script Zerby
  7. Can these be used commerically? :)
  8. Is the script suppose to be all in one line? (Sorry, kinda new to this)
  9. YNWL said:
    Is the script suppose to be all in one line? (Sorry, kinda new to this)

    No, it is not supposed to be that way.


    A forum update a while ago broke the script formats on all post, you would have to manually enter the line breaks again before you can use the script
  10. Andar said:
    No, it is not supposed to be that way.


    A forum update a while ago broke the script formats on all post, you would have to manually enter the line breaks again before you can use the script

    Well crap, thanks for the help.
  11. Would this work on MV>?
  12. @Loz No it won't. Ace scripts are written in Ruby, MV plugins are written in Javascript.
  13. Scripts fixed
    Zarby - Image core
    Code:
    #==============================================================================
    # ** Game_Images
    #------------------------------------------------------------------------------
    #  This Module handles Image Creations.
    #==============================================================================
    module Game_Images 
    #-------------------------------------------------------------------------- 
    # * Numbers 
    #-------------------------------------------------------------------------- 
        def self.zero   
            b = Bitmap.new(6,12)   
            b.fill_rect(b.rect, Color.new(255,255,255))   
            b.clear_rect(2,2,2,8)   
            return b 
        end 
        def self.one   
            b = Bitmap.new(6,12)   
            b.fill_rect(4,0,5,12, Color.new(255,255,255))   
            return b 
        end 
        def self.two   
            b = Bitmap.new(6,12)   
            b.fill_rect(b.rect, Color.new(255,255,255))   
            b.clear_rect(0,2,4,3)   
            b.clear_rect(2,7,4,3)   
            return b 
        end 
        def self.three   
            b = Bitmap.new(6,12)   
            b.fill_rect(b.rect, Color.new(255,255,255))   
            b.clear_rect(0,2,4,3)   
            b.clear_rect(0,7,4,3)   
            return b 
        end 
        def self.four   
            b = Bitmap.new(6,12)   
            b.fill_rect(b.rect, Color.new(255,255,255))   
            b.clear_rect(2,0,2,5)   
            b.clear_rect(0,7,4,5)   
            return b 
        end 
        def self.five   
            b = Bitmap.new(6,12)   
            b.fill_rect(b.rect, Color.new(255,255,255))   
            b.clear_rect(2,2,4,3)   
            b.clear_rect(0,7,4,3)   
            return b 
        end 
        def self.six   
            b = Bitmap.new(6,12)   
            b.fill_rect(b.rect, Color.new(255,255,255))   
            b.clear_rect(2,0,5,5)   
            b.clear_rect(2,7,2,3)   
            return b 
        end 
        def self.seven   
            b = Bitmap.new(6,12)   
            b.fill_rect(b.rect, Color.new(255,255,255))   
            b.clear_rect(0,2,4,10)   
            return b 
        end 
        def self.eight   
            b = Bitmap.new(6,12)   
            b.fill_rect(b.rect, Color.new(255,255,255))   
            b.clear_rect(2,2,2,3)   
            b.clear_rect(2,7,2,3)   
            return b 
        end 
        def self.nine   
            b = Bitmap.new(6,12)   
            b.fill_rect(b.rect, Color.new(255,255,255))   
            b.clear_rect(2,2,2,3)   
            b.clear_rect(0,7,4,5)   
            return b 
        end 
        def self.nbrstripe   
            b = Bitmap.new(60,12)   
            bb = self.zero   
            b.blt(0, 0,bb ,bb.rect)   
            bb = self.one   
            b.blt(6, 0,bb ,bb.rect)   
            bb = self.two   
            b.blt(12, 0,bb ,bb.rect)   
            bb = self.three   
            b.blt(18, 0,bb ,bb.rect)   
            bb = self.four   
            b.blt(24, 0,bb ,bb.rect)   
            bb = self.five   
            b.blt(30, 0,bb ,bb.rect)   
            bb = self.six   
            b.blt(36, 0,bb ,bb.rect)   
            bb = self.seven   
            b.blt(42, 0,bb ,bb.rect)   
            bb = self.eight   
            b.blt(48, 0,bb ,bb.rect)   
            bb = self.nine   
            b.blt(54, 0,bb ,bb.rect)   
            return b 
        end   
    end
    #==============================================================================
    # ** Bitmap Class
    #------------------------------------------------------------------------------
    #  Modify the Bitmap class to draw our new number
    #==============================================================================
    class Bitmap 
        def draw_custom_text(text,x,y)   
            b = Game_Images.nbrstripe   
            for i in 0..text.size-1     
                if (text[i].ord >= 48 && text[i].ord <= 57)       
                    blt(x+(i*7), y, b, Rect.new((text[i].ord-48)*6,0,6,12))       
                end   
            end 
        end
    end
    #==============================================================================
    # ** Sprite Class
    #------------------------------------------------------------------------------
    #  Modify the Bitmap class to add Bounding Box method
    #==============================================================================
    class Sprite 
        def boundingbox()   
            return Rect.new(x,y,src_rect.width,src_rect.height) 
        end
    end
    Zarby Pong
    Code:
    #==============================================================================
    #Pong V0.1
    #Author : Zarby - No Credit Required, free to use
    #Rule first to score 10 point win
    # SceneManager.call(Scene_Pong)
    #==============================================================================
    #==============================================================================
    # ** Game_Images
    #------------------------------------------------------------------------------
    #  This Module handles Image Creations.
    #==============================================================================
    module Game_Images 
    #-------------------------------------------------------------------------- 
    # * Paddle Image 
    #-------------------------------------------------------------------------- 
        def self.paddle   
            b = Bitmap.new(8,32)   
            b.fill_rect(b.rect, Color.new(255,255,255))   
            return b 
        end 
    #-------------------------------------------------------------------------- 
    # * Ball Image 
    #-------------------------------------------------------------------------- 
        def self.ball   
            b = Bitmap.new(8,8)   
            b.fill_rect(b.rect, Color.new(255,255,255))   
            return b 
        end 
    end
    #==============================================================================
    # ** Scene_Pong
    #------------------------------------------------------------------------------
    #  This Class perform the game processing "Pong"
    #==============================================================================
    class Scene_Pong < Scene_Base 
    #-------------------------------------------------------------------------- 
    #DIFFICULTY SETTING 
        Difficulty = 15 
    #12 = Very Easy,14 = Easy, 16 = Hard, 18 = Very Hard, 20 Impossible 
    #0 = AI wont move at all, 10 = AI Move 1 on 2, 20 = AI Follow the ball 
    #VARIABLE RETURN IF WIN OR NOT 
        ReturnVariable = 10 
    #IF we win the variable will = 1, if we loose variable = 0 / -1 if leave 
    #--------------------------------------------------------------------------   
    #-------------------------------------------------------------------------- 
    # * Start Processing 
    #-------------------------------------------------------------------------- 
        def start   
            super   
            set_score   
            add_sprite   
            reset_ball   
            @ai_move = 0   
            @ai_timer = 0   
            @pause = false 
        end   
        def add_sprite   
            @player_paddle = Sprite.new()   
            @cpu_paddle = Sprite.new()   
            @ball = Sprite.new()   
            @player_paddle.bitmap = Game_Images.paddle   
            @cpu_paddle.bitmap = Game_Images.paddle   
            @ball.bitmap = Game_Images.ball   
            @player_paddle.x = 16   
            @player_paddle.y = 220   
            @cpu_paddle.x = 520   
            @cpu_paddle.y = 220   
            @ball.x = 268   
            @ball.y = 204   
            @scorep1_spr = Sprite.new()   
            b = Bitmap.new(24,12)   
            b.draw_custom_text(sprintf('%02d',@scorep1),0,0)   
            @scorep1_spr.bitmap = b   
            @scorep1_spr.zoom_x = 2   
            @scorep1_spr.zoom_y = 2   
            @scorep1_spr.x = 120   
            @scorep1_spr.y = 8   
            @scorep2_spr = Sprite.new()   
            b = Bitmap.new(24,12)   
            b.draw_custom_text(sprintf('%02d',@scorep2),0,0)   
            @scorep2_spr.bitmap = b   
            @scorep2_spr.zoom_x = 2   
            @scorep2_spr.zoom_y = 2   
            @scorep2_spr.x = 544-120   
            @scorep2_spr.y = 8   
            @timer_spr = Sprite.new()   
            @timer_spr.x = 260 
        end   
        def set_score   
            @scorep1 = 0   
            @scorep2 = 0 
        end   
        def reset_ball   
            @timer = 3   
            @bugtimer = 0   
            @real_timer = 120   
            @started = false   
            @ball_speed = 4   
            @real_ball_x = 268.0   
            @real_ball_y = 204.0   
            @ball.x = @real_ball_x   
            @ball.y = @real_ball_y   
            @ball_direction = 0   
            update_score 
        end   
        def update_score   
            b = Bitmap.new(24,12)   
            b.draw_custom_text(sprintf('%02d',@scorep2),0,0)   
            @scorep2_spr.bitmap = b   
            b = Bitmap.new(24,12)   
            b.draw_custom_text(sprintf('%02d',@scorep1),0,0)   
            @scorep1_spr.bitmap = b 
        end   
        def update_timer   
            if (@real_timer >= 0)     
                @timer_spr.visible = true     
                @real_timer -=1     
                @timer = @real_timer / 30     
                b = Bitmap.new(24,12)     
                b.draw_custom_text(sprintf('%02d',@timer),0,0)     
                @timer_spr.bitmap = b     
                if (@real_timer == 0)       
                    @real_timer = -1       
                    @timer = -1       
                    game_start       
                    @timer_spr.visible = false     
                end   
            end 
        end   
        def game_start    #Set ball direction   
            rand = Random.new()   
            @ball_side_x = rand.rand(0..1).to_i   
            @ball_side_y = rand.rand(0..1).to_i   
            @started = true   
            @ball_direction = rand.rand(-70..70) 
        end 
        def update   
            super   
            if (@pause == false)     
                update_timer     
                if (@started)       
                    if (@ball_side_x == 1)         
                        @real_ball_x += @ball_speed * Math.cos(degtorad(@ball_direction));       
                    elsif (@ball_side_x == 0)         
                        @real_ball_x -= @ball_speed * Math.cos(degtorad(@ball_direction));       
                    end       
                if (@ball_side_y == 1)         
                    @real_ball_y += @ball_speed * Math.sin(degtorad(@ball_direction));       
                elsif (@ball_side_y == 0)         
                    @real_ball_y -= @ball_speed * Math.sin(degtorad(@ball_direction));       
                end             
                @ball.x = @real_ball_x       
                @ball.y = @real_ball_y     
                end          #Bug Solver?     
                if (@ball.y == 4)       
                    @bugtimer+=1       
                    if (@bugtimer >= 160)         
                        reset_ball       
                    end     
                else       
                    @bugtimer = 0     
                end             
                player_control     
                check_collision     
                ai_control # Stupid AI     
            end   
            if (Input.trigger?(:X))     
                if (@pause == false)       
                    @pause = true     
                elsif(@pause == true)       
                    @pause = false     
                end   
            end       
            if (@scorep1 >= 10)     
                $game_variables[ReturnVariable] = 1     
                dispose   
            end   
            if (@scorep2 >= 10)     
                $game_variables[ReturnVariable] = 0     
                dispose   
            end       
            if (Input.press?(:B))     
                $game_variables[ReturnVariable] = -1     
                dispose     
            end 
        end   
        def dispose   
            @player_paddle.dispose   
            @cpu_paddle.dispose   
            @scorep1_spr.dispose   
            @scorep2_spr.dispose   
            @timer_spr.dispose   
            #return_scene   
            SceneManager.goto(Scene_Map) 
        end   
    #----------------------------------------------------------------------------- 
    # Control if the player is pressing a key 
    #----------------------------------------------------------------------------- 
        def player_control   
            if (Input.press?(:UP))     
                @player_paddle.y -=4     
                if (@player_paddle.y < 0)       
                    @player_paddle.y = 0     
                end   
            end   
            if (Input.press?(:DOWN))     
                @player_paddle.y +=4     
                if (@player_paddle.y > 416-32)       
                    @player_paddle.y = 416-32     
                end   
            end 
        end     
        def ai_control   
            @ai_timer += 1   
            rand = Random.new()       
            if (@ai_timer >= 10)     
                @ai_move = rand.rand(0..20)
          #Rand if move < 10, else > 10     
          @ai_timer = 0   
        end       
        if (@ai_move < Difficulty)     
          if (@ball_side_x ==1)             
            if (@ball.y+2 < @cpu_paddle.y+16)         
              @cpu_paddle.y-=4       
            end             
            if (@ball.y+2 > @cpu_paddle.y+16)         
              @cpu_paddle.y+=4       
            end             
            if (@cpu_paddle.y < 0)         
              @cpu_paddle.y = 0       
            end       
            if (@cpu_paddle.y > 416-32)         
              @cpu_paddle.y = 416-32       
            end             
          end   
        end 
      end   
    #----------------------------------------------------------------------------- 
    # Check Collison between ball and wall, paddle 
    #----------------------------------------------------------------------------- 
        def check_collision   
            if (@ball.y <= 0)     
            @ball.y = @ball_speed     
                if (@ball_side_y == 0)       
                    @ball_side_y = 1     
                elsif (@ball_side_y == 1)       
                    @ball_side_y = 0     
                end   
            end       
            if (@ball.y >= 412)     
                @ball.y = 412 - @ball_speed     
                if (@ball_side_y == 0)       
                    @ball_side_y = 1     
                elsif (@ball_side_y == 1)       
                    @ball_side_y = 0     
                end   
            end       
            if (@ball.x >= 540)     
                @scorep1+=1     
                reset_ball   
            end   
            if (@ball.x <= 0)     
                @scorep2+=1     
                reset_ball   
            end   
            if (rectangle_intersect(@ball.boundingbox,@player_paddle.boundingbox) == true)     
                @ball.x = (@player_paddle.x + 4 + @ball_speed)     
                @ball_side_x = 1     
                @ball_direction = (-50 + ((@ball.y+2)-@player_paddle.y)*4)     
                if ((@ball.y+4)-@player_paddle.y) < 16       
                    @ball_side_y = 1     
                end     
                if ((@ball.y+4)-@player_paddle.y) > 16       
                    @ball_side_y = 1     
                end   
            end       
            if (rectangle_intersect(@ball.boundingbox,@cpu_paddle.boundingbox) == true)     
                @ball.x = (@cpu_paddle.x - 4 - @ball_speed)     
                @ball_side_x = 0     
                @ball_direction = (-50 + ((@ball.y+2)-@cpu_paddle.y)*4)     
                if ((@ball.y+4)-@cpu_paddle.y) < 16       
                    @ball_side_y = 1     
                end     
                if ((@ball.y+4)-@cpu_paddle.y) > 16       
                    @ball_side_y = 1     
                end   
            end     
        end   
    #----------------------------------------------------------------------------- 
    # If 2 rectangle interset return true 
    #----------------------------------------------------------------------------- 
        def rectangle_intersect(r1,r2)   
            if ((r1.x+r1.width > r2.x) && (r1.x < r2.x+r2.width) &&       
            (r1.y+r1.height > r2.y) && (r1.y < r2.y+r2.height))     
            return true   
            end   
            return false 
        end   
        def degtorad(deg)   
            return (deg * Math::PI / 180) 
        end 
    end
    Zarby Space Explorer
    Code:
    #==============================================================================
    #SpaceExplorer V0.1
    #Author : Zarby - No Credit Required, free to use
    #Go the furthest you can !
    # SceneManager.call(Scene_SpaceExplorer)
    #==============================================================================
    #==============================================================================
    # ** Game_Images
    #------------------------------------------------------------------------------
    #  This Module handles Image Creations.
    #==============================================================================
    module Game_Images 
    #-------------------------------------------------------------------------- 
    # * Paddle Image 
    #-------------------------------------------------------------------------- 
        def self.spaceship   
            b = Bitmap.new(16,8)   
            b.fill_rect(1,1,3,1, Color.new(255,255,255))   
            b.fill_rect(5,1,2,1, Color.new(255,255,255))   
            b.fill_rect(7,0,2,2, Color.new(255,255,255))   
            b.fill_rect(9,0,2,1, Color.new(255,255,255))   
            b.fill_rect(11,1,2,1, Color.new(255,255,255))   
            b.fill_rect(13,2,1,1, Color.new(255,255,255))   
            b.fill_rect(14,3,1,3, Color.new(255,255,255))   
            b.fill_rect(4,5,10,2, Color.new(255,255,255))   
            b.fill_rect(2,2,8,4, Color.new(255,255,255))   
            b.fill_rect(6,4,5,4, Color.new(255,255,255))   
            b.fill_rect(1,3,1,1, Color.new(255,255,255))   
            b.fill_rect(1,5,1,1, Color.new(255,255,255))   
            return b 
        end 
        #272x208 x2
    end
    #==============================================================================
    # ** Scene_SpaceExplorer
    #------------------------------------------------------------------------------
    #  This Class perform the game processing "SpaceExplorer"
    #==============================================================================
    class Scene_SpaceExplorer < Scene_Base 
    #-------------------------------------------------------------------------- 
    #SETTINGS 
        ReturnVariable = 10 
    #Return the score to the variable 
    #--------------------------------------------------------------------------   
    #-------------------------------------------------------------------------- 
    # * Start Processing 
    #-------------------------------------------------------------------------- 
        def start   
            super   
            @map = []   
            @space_between = 32   
            create_map   
            create_sprites   
            @score = 0   
            @lastvalue = 104   
            @lastdirectiontimer = 0   
            @lastdirection = 0   
            @scoretimer = 0   
            @deadtimer = 0   
            @pause = false   
            @dead = false 
        end   
        def create_sprites   
            @spaceship_spr = Sprite.new()   
            b = Bitmap.new(32,16)   
            b.stretch_blt(Rect.new(0,0,32,16), Game_Images.spaceship, Rect.new(0,0,16,8))     
            @bgr_bitmap = Bitmap.new(288,208)   
            @bgr_spr = Sprite.new()   
            @spaceship_spr.bitmap = b   
            @spaceship_spr.x = 16*2   
            @spaceship_spr.y = 104*2   
            @sprite_score = Sprite.new   
            @sprite_score.x = 544/2-(5*7)   
            @sprite_score.y = 400   
            update_image 
        end 
    #-------------------------------------------------------------------------- 
    # * Update Processing 
    #-------------------------------------------------------------------------- 
        def update   
            super   
            if (@pause == false)     
                @bgr_spr.x-=4;     
                @scoretimer+=1     
                if (@scoretimer >= 15)       
                    @score+=1       
                    @scoretimer = 0       
                    b = Bitmap.new(64,16)       
                    b.fill_rect(0,0,64,16,Color.new(0,0,0))       
                    b.draw_custom_text(sprintf('%08d',@score),4,2)       
                    @sprite_score.bitmap = b     
                end         
                if ((@spaceship_spr.y / 2) <= (@map[2]-@space_between))       
                    @pause = true       
                    @dead = true     
                end     
                if ((@spaceship_spr.y / 2) <= (@map[3]-@space_between))       
                    @pause = true       
                    @dead = true     
                end         
                if ((@spaceship_spr.y / 2)+8 >= (@map[2]+@space_between))       
                    @pause = true       
                    @dead = true     
                end     
                if ((@spaceship_spr.y / 2)+8 >= (@map[3]+@space_between))       
                    @pause = true       
                    @dead = true     
                end           
                if (@bgr_spr.x <=-16)       
                    update_map       
                    update_image       
                    @bgr_spr.x = 0     
                end     
                player_control   
            else     
                if (@dead == true)       
                    @deadtimer +=1       
                    if (@deadtimer == 120)         
                        dispose       
                    end     
                end   
            end       
            if (Input.trigger?(:X))     
                if (@pause == false)       
                    @pause = true     
                elsif(@pause == true)       
                    @pause = false     
                end   
            end         
        end
            #update end   
        def create_map   
            m = 0   
            for i in 0..36     
                @map[i] = 104   
            end 
        end   
        def dispose   
            $game_variables[ReturnVariable] = @score   
            @bgr_spr.dispose   
            @spaceship_spr.dispose
            @sprite_score.dispose
            SceneManager.goto(Scene_Map)
        end
        def update_map
            @space_between = 32   
            @lastdirectiontimer+=1   
            rand = Random.new()   
            if (@lastdirectiontimer >=rand.rand(0..3))           
                a = rand.rand(-1..1)     
                @lastdirection = 0     
                if (a == -1)       
                    if (@lastvalue >= @space_between+8)         
                        @lastvalue-=4;         
                        @lastdirection = -1       
                    else         
                        @lastdirection = 1       
                    end               
                end     
                if (a == 1)       
                    if (@lastvalue <= 180-@space_between)         
                        @lastvalue+=4;         
                        @lastdirection = 1       
                    else         
                        @lastdirection = -1       
                    end     
                end       
                @lastdirectiontimer = 0   
            end   
            r = rand.rand(0..100)       
            if (@lastdirection == -1)     
                @lastvalue-=4     
                if (r >= 75)       
                    @lastvalue-=4     
                end   
            end   
            if (@lastdirection == 1)     
                @lastvalue+=4     
                if (r >= 75)       
                    @lastvalue+=4     
                end   
            end               
            oldmap = @map   
            for i in 0..36     
                if (i != 36)       
                    @map[i] = oldmap[i+1]     
                else       
                    @map[i] = @lastvalue     
                end   
            end     
        end     
    #----------------------------------------------------------------------------- 
    # Control if the player is pressing a key 
    #----------------------------------------------------------------------------- 
        def player_control   
            if (Input.press?(:UP))     
                @spaceship_spr.y -=2     
                if (@spaceship_spr.y < 0)       
                    @spaceship_spr.y = 0     
                end   
            end   
            if (Input.press?(:DOWN))     
                @spaceship_spr.y +=2     
                if (@spaceship_spr.y > 416-8)       
                    @spaceship_spr.y = 416-8     
                end   
            end 
        end     
        def update_image   
            @bgr_bitmap = Bitmap.new(288,208)   
            for i in 0..36     
                mn = (@map[i]-@space_between)     
                mp = (@map[i]+@space_between)     
                @bgr_bitmap.fill_rect(i*8,0,8,mn,Color.new(132,68,20))     
                @bgr_bitmap.fill_rect(i*8,mp,8,288-mp,Color.new(132,68,20))         
            end   
            stretchedbmp = Bitmap.new(576,416)   
            stretchedbmp.stretch_blt(Rect.new(0,0,576,416), @bgr_bitmap, Rect.new(0,0,288,208))     
            @bgr_spr.bitmap = stretchedbmp 
        end   
    end
  14. Kes said:
    @Loz No it won't. Ace scripts are written in Ruby, MV plugins are written in Javascript.
    Thank you Kes