TI-BASIC For Beginners E08: Other Loops

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

КОМЕНТАРІ • 10

  • @zbricks5992
    @zbricks5992 5 років тому +4

    Hey calcutron love the vids!
    Currently I am making a game where objects come from the right and left sides and you have to move your character to dodge them. I have a while loop so the character can move but I am having trouble with the object you have to dodge. Once it goes of the screen, it spawns back on its origin side, but does not move! I have no idea if I should make another loop for the obstacles or do something else. Please help!
    Cheers, Z Bricks

    • @HartleySan
      @HartleySan 10 місяців тому

      You likely want to have one loop to handle all the objects (and players) on the screen. Basically, for each iteration of the loop, you'll need to do the necessary calculations to figure out where to put the player, the various objects, etc., and then render them all at once at the end of each loop iteration. Hopefully that makes sense.

    • @saminegamme
      @saminegamme 9 місяців тому +1

      @@HartleySan is this the Game Loop i use it a lot in python i say
      running = True
      while running:
      do Game stuff
      if input == "/exit":
      running = False

    • @HartleySan
      @HartleySan 9 місяців тому

      @@saminegamme Yes, that makes perfect sense.

    • @zbricks5992
      @zbricks5992 9 місяців тому

      @@HartleySan Thanks for the response. I dropped my calculator a few years ago and the memory got cleared. I've moved past calculator programming now haha

    • @HartleySan
      @HartleySan 9 місяців тому

      @@zbricks5992 Hehe! I hear ya (and sorry about the break). But yes, TI programming is a great primer, but once you move past it, it's hard to go back.

  • @mushymud4760
    @mushymud4760 4 роки тому +1

    How do you make a loop that runs throughout a program? I’m trying to put a score that just displays the score in the corner but it either keeps repeating the score and doesn’t continue with the program or it won’t show the score. Please help.

    • @jonah1077
      @jonah1077 4 роки тому +1

      Travis’s Hamsters I may be wrong, but I think you have to make another program of just this:
      while 1
      (display the score)
      end
      In your main program, execute that program on the first line, and see if that helps.

    • @HartleySan
      @HartleySan 10 місяців тому

      Yes, I think jonah's suggestion may work. You can also just have one loop that's constantly running in the background, and then update the score when need be. That means that most iterations will just be the same score rendering over and over again, but that's completely normal and fine in games. All games have the concept of an animation/game loop that's constantly running in the background at the desired framerate, and the code in the loop simply re-renders everything on the screen each iteration, even if most frames nothing changes.