Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Help with loops

Okay I'm calling a loop and I'm wondering how I'm supposed rework so it doesn't bring up an error. I'm using it inside Scene Battle

Code:
loop do
      @skillshotarrow.update
      if @skillshotarrow.x < 640 - 77 and @direction == 0
        @skillshotarrow.x += 5
        if @skillshotarrow.x >= 640 - 77
          @direction = 1
        end
      elsif @skillshotarrow.x > 73 and @direction == 1
        @skillshotarrow.x -= 5
        if @skillshotarrow.x <= 73
          @direction = 0
        end
      end
      if Input.trigger?(Input::C)
        @skillshotvar += 1
        @skillshotx = @skillshotarrow.x
        if @skillshotx.between?(142,247)
          @skillshotpower += 1
        end
      end
      # Abort loop if screen is changed
      if @skillshotvar >= 3
        break
      end
    end
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top