QBasic Tutorial 48 - Bouncing Ball Animation - QB64

Поділитися
Вставка
  • Опубліковано 22 гру 2024

КОМЕНТАРІ •

  • @mik4k6
    @mik4k6 11 років тому +1

    30 years ago, this was mind-blowing. (Pong, anyone?) Now, it's super simple, depending on a person's skills.
    Very nice, I like it.

  • @0609111213
    @0609111213 8 років тому +4

    Thank you, on this principle, I just wrote a screensaver.

  • @studyaccount6160
    @studyaccount6160 4 роки тому

    can you explain pcopy display

  • @RahulT-oy1br
    @RahulT-oy1br 8 років тому

    Is it necessary to use declare image as long are can we declare it as an integer or double or single too?

  • @sathidas5027
    @sathidas5027 4 роки тому

    You have told how to insert a picture, now can you tell how to remove a picture?

  • @RahulT-oy1br
    @RahulT-oy1br 8 років тому

    I dont get the pcopy stuff

  • @noorhakeem1878
    @noorhakeem1878 7 років тому

    why do you need this Moveup & -right variable extra here?

    • @bombi8709
      @bombi8709 3 роки тому

      Its used to check the acceleration direction and change accordingly

  • @ProgramGuy3456
    @ProgramGuy3456 11 років тому

    That is pretty cool

  • @amograo3347
    @amograo3347 8 років тому

    U R AWESOME

  • @debunirula4532
    @debunirula4532 9 років тому

    WOAHHHHHHHH

  • @CreeperGabe
    @CreeperGabe 10 років тому +2

    SCREEN _NEWIMAGE(800, 600, 13)
    DO
    IF x + mx > 774 THEN mx = -3 ELSE IF x + mx < 25 THEN mx = 3
    IF y + my > 574 THEN my = -3 ELSE IF y + my < 25 THEN my = 3
    x = x + mx
    y = y + my
    CIRCLE (x, y), 25, 40
    PAINT (x, y), 40
    _DISPLAY
    _LIMIT 100
    CLS
    LOOP UNTIL LEN(INKEY$)
    Bam! 12 liner!

    • @crspunx3304
      @crspunx3304 9 років тому

      +CreeperGabe
      SCREEN 7, , 0, 1
      x = 100 : y = 100 : xs = 1 : ys = 1
      DO
      _Limit 220
      x = x + xs : y = y + ys
      IF x >= 320 OR x = 200 OR y

    • @GabrielMiceli
      @GabrielMiceli 8 років тому +1

      +Newborn Kid (TheKidNew) -- There are some differences between your program and mine. Your program: Has a 320x200 LEGACY 4-bit color screen; Doesn't fill the ball with color; Doesn't check for Y collision if X collision has been detected; Uses PCOPY instead of _DISPLAY (and thus, in turn, uses pages); Uses a green ball (Not that it matters, but I was trying to replicate SchoolFreeware's ball program); Allows part of the ball to go off-screen; Has FOURTEEN lines of code, not NINE. You cheated by adding colons. My program: Uses a customized 800x600 8-bit color screen; Has a ball that resembles the one shown in the video; Checks for both X and Y collision no matter the condition of one; Uses certain numbers that allows the ball to bounce, and not clip, off of the screen; Has a higher framerate (100 FPS) and yours is limited (you didn't use _DISPLAY); Doesn't set a starting point for the ball (X and Y are 0); Has 12 lines of code. Another problem with yours, is that X and Y often have collision at the same time, so X gets reversed, Y doesn't, and the program gets passed along. This causes Y to equal -1, and every time Y collision is detected, Y would flip between 0 and -1, causing the ball to appear to stay inside the ceiling. This continues until X is 0, collision isn't detected in Y, and the ball is freed. Bouncing off corners is glitched.

    • @crspunx3304
      @crspunx3304 8 років тому

      Gabriel Miceli
      I know it, but is easier to understand.

    • @KingPing1
      @KingPing1 8 років тому

      SCREEN _NEWIMAGE(800, 600, 13)
      DO
      IF x + mx > 774 THEN mx = -3 ELSE IF x + mx < 25 THEN mx = 3
      IF y + my > 574 THEN my = -3 ELSE IF y + my < 25 THEN my = 3
      x = x + mx
      y = y + my
      CIRCLE (x, y), 25, 40
      PAINT (x, y), 40
      _DISPLAY
      _LIMIT 100
      CLS
      LOOP UNTIL LEN(INKEY$)
      Bam! 12 liner!

    • @noorhakeem1878
      @noorhakeem1878 7 років тому

      Why do you need mx & my here? why doesn´t it work like this way- IF x > 774 THEN x =x -3 ELSE IF x < 25 THEN x =x+ 3 and so on.....

  • @crazymofo3829
    @crazymofo3829 6 років тому

    you could've made it shorter
    SCREEN _NEWIMAGE(800, 600, 32)
    ball = _LOADIMAGE("ball3.png")
    x = 0: y = 0: Xmovement = 1: Ymovement = 1
    DO
    _LIMIT 600
    PCOPY _DISPLAY, 1
    x = x + Xmovement
    y = y + Ymovement
    _PUTIMAGE (x, y), ball
    _DISPLAY
    PCOPY 1, _DISPLAY
    IF x >= 799 - 50 OR x = 599 - 50 OR y