Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pygame 2d game
#1
I need help, I am writing a 2D game in the library pygame, I need to add monsters and logic to monsters who attack the main character, I know that I need a class and register the logic in the main cycle, but I don’t know how to implement it. I ask for help. stuff on https://github.com/Maximk301/2dgame
Reply
#2
If they are just walking towards your main character then the logic for that is to move them towards the character until they are close enough to attack (Whatever that may be). Then check for collision, if so, then reduce player health. If zombies collide with characters weapon then reduce their health, or kill them, etc. This is the basic concept. To do this is slightly different based on topdown, side scrolling, etc. game play, but it is basically the same. You can check our tutorials which include the enemy class. Part 1 through 8 is a series creating a vertical scrolling space shooter. The logic can be mostly adapted for a side scroller. The enemies section is part 6.
Recommended Tutorials:
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Isometric game pygame Tiled howardberger 1 601 Jan-31-2024, 10:01 PM
Last Post: deanhystad
  pygame error in my clicker game CrazyMakes 2 2,553 Apr-19-2020, 03:04 AM
Last Post: Windspar
  Basically a Python Tetris game [pygame] rather keyboard arrows can be controlled with lsepolis123 9 5,106 Sep-10-2019, 08:12 PM
Last Post: metulburr
  simple pygame game kinglarry0327 0 8,946 Jan-06-2019, 06:18 PM
Last Post: kinglarry0327
  Pygame vs TKinter for a Quiz Game? SteampunkMaverick12 1 4,726 May-21-2018, 05:31 PM
Last Post: j.crater
  How to begin coding for game making [Install pygame on mac] mattkrebs 2 4,951 Apr-02-2017, 10:57 AM
Last Post: machrider

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020