Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Need help with NPC (bot)
#1
Hi, my name is Paul and I would like to make a simple game. In the game I wish to add a bot that could jump at random times on its own. It would be amazing if someone could help me out.
Quote
#2
Hello, Paul. You'll need to provide a little more information if you want help. Have you coded any part of the game already? You need to show what you've tried and clarify what you are trying to accomplish.
Quote
#3
As GOTO10 said, without knowing what your game is, specific help is impossible.

With pygame, this is how I time random things in my games (mostly, enemies to shoot at random intervals).

random_chance_role = pg.random.randrange(1000)
if random_chance_role < 5:
          do_random_thing = True  # OR whatever your game requires
This will give you a .5% chance / frame. You can change the numbers to suit your needs.
Quote

Top Page

Forum Jump:


Users browsing this thread: 1 Guest(s)