Battle Maker

Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Suporte para criação de Jogos


    Ultimate Pong Mini-Jogo BETA

    jiraya
    jiraya
    Administrador
    Administrador


    Mensagens : 1299
    Credibilidade : 54

    Ultimate Pong Mini-Jogo BETA Empty Ultimate Pong Mini-Jogo BETA

    Mensagem por jiraya Qui Jul 29, 2010 9:48 pm

    Autor: Johnny Mercy
    Resumo: É um mini jogo do famoso e nunca esquecido PONG. Contem um fundo animado que varia consoante a posição e velocidade da bola. É possivel costumizar várias coisas como podem ver no ínicio do Script. É provavel que encontre algum bug pois ainda está em fase de testes.

    Como Instalar:
    1. Colocar o script em cima do Main
    2. Copiar as imagens para a pasta PICTURES do vosso jogo
    3. Para chamar o mini-jogo crie um evento e na opção chamar script coloquem $scene = Pong_Main.new
    Como Jogar:
    • Setas direcionais para cima e para baixo
    • Shift para sair do mini-jogo




    Script:

    Código:
    ##############################################################
    # Script By Johnny Mercy
    # Program: Rpg Maker VX
    # Language: RGSS2
    ##############################################################
    # Class Configurations
    ##############################################################

    module MyModule
     
      #Nome da tela de fundo (Layer = 0)
      BgPlaneImage = "BGPlaneImage"
     
      #Nome da tela de fundo (Layer = 1)
      BgImage = "BGImage"
     
      #Nome da imagem da bola
      BallImage = "Ball"
     
      #Nome da imagem dos Tacos
      BatImage = "Bat"
     
    end

    ##############################################################
    # Class Pong_Main
    ##############################################################

    class Pong_Main < Scene_Base
     
      def initialize
        #Game Vars:
        @BallSpeedX = 1.5
        @BallSpeedY = 1.5
        @Bat1Speed = 3
        @Bat2Speed = 3
        #Procedures:
        createBG
        createBall
        createBats
      end
     
      def createBG
        #BG LAYER 0
        @BGPlane = Plane.new
        @BGPlane.bitmap = Cache.picture(MyModule::BgPlaneImage)
        @BGPlane.z = 0
        #BG LAYER 1
        @BGImage = Sprite.new
        @BGImage.bitmap = Cache.picture(MyModule::BgImage)
        @BGImage.x = 0
        @BGImage.y = 0
      end
     
      def createBats
        #Player Bat
        @Bat1 = Sprite.new
        @Bat1.bitmap = Cache.picture(MyModule::BatImage)
        @Bat1.x = 0
        @Bat1.y = Graphics.height / 2 - (@Bat1.height / 2)
        #CPU Bat
        @Bat2 = Sprite.new
        @Bat2.bitmap = Cache.picture(MyModule::BatImage)
        @Bat2.x = Graphics.width - @Bat2.width
        @Bat2.y = Graphics.height / 2 - (@Bat2.height / 2)
      end
     
      def createBall
        #Ball
        @Ball = Sprite.new
        @Ball.bitmap = Cache.picture(MyModule::BallImage)
        initializeBall
      end
     
      def initializeBall
        @Ball.x = Graphics.width / 2 - (@Ball.width / 2)
        @Ball.y = Graphics.height / 2 - (@Ball.height / 2)
        placeHolder = rand(3)
        if placeHolder <= 1
          @BallSpeedX = -2
          @BallSpeedY = -2
        else
          @BallSpeedX = 2
          @BallSpeedY = 2
        end
      end
     
      #-----------------------------------------------------------
     
      def update
        @BGPlane.oy += @BallSpeedY
        playerInput
        cpuIA
        ballMovement
        ballBoundry
        #Tecla para sair do Pong:
        $scene = Scene_Map.new if (Input.trigger?(Input::A))
      end
     
      def cpuIA
        @Bat2.y += @Bat2Speed if (@Ball.y + @Ball.height / 2 > @Bat2.y + @Bat2.height / 2 and @Bat2.y + @Bat2.height + @Bat2Speed < (Graphics.height - 11))
        @Bat2.y -= @Bat2Speed if (@Ball.y + @Ball.height / 2 < @Bat2.y + @Bat2.height / 2 and @Bat2.y - @Bat2Speed > 10)
      end
     
      def playerInput
        @Bat1.y += @Bat1Speed if ((Input.press?(Input::DOWN)) and ((@Bat1.y + @Bat1.height + @Bat1Speed) < (Graphics.height - 11)))
        @Bat1.y -= @Bat1Speed if ((Input.press?(Input::UP)) and ((@Bat1.y - @Bat1Speed) > 10))
      end
     
      def ballMovement
        @Ball.x += @BallSpeedX
        @Ball.y += @BallSpeedY
      end
     
      def ballBoundry
        if (@Ball.y < 10)
          @Ball.y = 10
          @BallSpeedY *= -1
        end
        if (@Ball.y + @Ball.height > Graphics.height - 13 )
          @Ball.y = Graphics.height - 14 - @Ball.height
          @BallSpeedY *= -1
        end
        if (((@Ball.x > @Bat1.x and @Ball.x <= @Bat1.x + @Bat1.width) and (@Ball.y + (@Ball.height / 2) > @Bat1.y and  @Ball.y + (@Ball.height / 2) < @Bat1.y + @Bat1.height)) or ((@Ball.x + @Ball.width > @Bat2.x and @Ball.x + @Ball.width <= @Bat2.x + @Bat2.width) and (@Ball.y + (@Ball.height / 2) > @Bat2.y and  @Ball.y + (@Ball.height / 2) < @Bat2.y + @Bat1.height)))
          increaseSpeed
          @BallSpeedX *= -1
        end
        initializeBall if (@Ball.x > Graphics.width or @Ball.x + @Ball.width < 0)
      end
     
      def increaseSpeed
        @BallSpeedX -= 0.4 if (@BallSpeedX < 0)
        @BallSpeedX += 0.4 if (@BallSpeedX > 0)
        @BallSpeedY -= 0.4 if (@BallSpeedY < 0)
        @BallSpeedY += 0.4 if (@BallSpeedY > 0)
      end
     
      #-----------------------------------------------------------
     
      def terminate
        @Bat1.dispose
        @Bat2.dispose
        @Ball.dispose
        @BGPlane.dispose
        @BGImage.dispose
      end
     
    end

    Demo

    [Tens de ter uma conta e sessão iniciada para poderes visualizar este link]

      Data/hora atual: Sex Mar 29, 2024 4:22 am