Python Forum
drawing, moving, and collision problems (pygame)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
drawing, moving, and collision problems (pygame)
#8
(Apr-15-2019, 11:41 PM)SheeppOSU Wrote: Can someone help me to fix that and one more thing, the sword doesn't deal damage until I stab through to the other side of the enemy. I tried to fix that problem but I couldn't figure out what I was doing wrong. Thx in advance.
It is much easier to fix issues if we can run the game. This is going to require you to clean your code.

1) You have hard coded a path that is only available on your computer. As well as i am on linux, so there is not even a C drive even. It is much better to load from a sub-directory of the game directory. In that way it can be moved to any computer with a different operating system and run.

Quote:
WoodBat = (pygame.image.load("C:/Users/Chadd/Desktop/Ayden Stuff/WoodenBat.png"),
           pygame.image.load("C:/Users/Chadd/Desktop/Ayden Stuff/WoodenBatRight.png"),
           pygame.image.load("C:/Users/Chadd/Desktop/Ayden Stuff/WoodenBatDown.png"),
           pygame.image.load("C:/Users/Chadd/Desktop/Ayden Stuff/WoodenBatLeft.png"))
SpikeBat = (pygame.image.load("C:/Users/Chadd/Desktop/Ayden Stuff/Spiked_Bat.png"),
            pygame.image.load("C:/Users/Chadd/Desktop/Ayden Stuff/Spiked_BatRight.png"),
            pygame.image.load("C:/Users/Chadd/Desktop/Ayden Stuff/Spiked_BatDown.png"),
            pygame.image.load("C:/Users/Chadd/Desktop/Ayden Stuff/Spiked_BatLeft.png"))
IronBat = (pygame.image.load("C:/Users/Chadd/Desktop/Ayden Stuff/MetalBat.png"),
           pygame.image.load("C:/Users/Chadd/Desktop/Ayden Stuff/MetalBatRight.png"),
           pygame.image.load("C:/Users/Chadd/Desktop/Ayden Stuff/MetalBatDown.png"),
           pygame.image.load("C:/Users/Chadd/Desktop/Ayden Stuff/MetalBatLeft.png"))
IronSword = (pygame.image.load("C:/Users/Chadd/Desktop/Ayden Stuff/IronSword.png"),
             pygame.image.load("C:/Users/Chadd/Desktop/Ayden Stuff/IronSwordRight.png"),
             pygame.image.load("C:/Users/Chadd/Desktop/Ayden Stuff/IronSwordDown.png"),
             pygame.image.load("C:/Users/Chadd/Desktop/Ayden Stuff/IronSwordLeft.png"))
DiamondSword = (pygame.image.load("C:/Users/Chadd/Desktop/Ayden Stuff/DiamondSword.png"),
                pygame.image.load("C:/Users/Chadd/Desktop/Ayden Stuff/DiamondSwordRight.png"),
                pygame.image.load("C:/Users/Chadd/Desktop/Ayden Stuff/DiamondSwordDown.png"),
                pygame.image.load("C:/Users/Chadd/Desktop/Ayden Stuff/DiamondSwordLeft.png"))

2) It is much easier to put your code up on github so people have access yo your resources. Read here for more info.

Doing this work will make it easier for people to help you along the way. I am a very visual person. I need to run the program and then follow your problems along the way, not just read through the code. I could switch over all your images to pygame surfaces. However you want the help. You are going to have to make it runnable for other people.

As a side note. Your numerous threads regarding this one program can be merged into one thread. After i merge these, please repost in the same thread if you come along another issue regarding this program.
Recommended Tutorials:
Reply


Messages In This Thread
RE: Drawing player and enemy (pygame) - by Windspar - Apr-14-2019, 10:25 AM
RE: pygame determining which enemy is taking damage and sword hit. - by metulburr - Apr-16-2019, 04:17 PM
pygame problems - by SheeppOSU - Apr-18-2019, 11:27 PM
pygame problems - by SheeppOSU - Apr-19-2019, 11:59 PM
changing position errors - by SheeppOSU - Apr-22-2019, 03:09 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question [PyGame] Problem with collision of player and enemy Nekotrooper 1 728 Dec-08-2023, 03:29 PM
Last Post: deanhystad
  pygame installation problems Gheryk 5 8,713 Nov-29-2023, 08:49 PM
Last Post: E_Mohamed
  can't get collision detection to work in platform game chairmanme0wme0w 10 3,909 Aug-19-2022, 03:51 PM
Last Post: deanhystad
  [PyGame] Problems with jump code in pygame Joningstone 4 5,434 Aug-23-2021, 08:23 PM
Last Post: deanhystad
  [PyGame] drawing images onto pygame window djwilson0495 1 3,526 Feb-22-2021, 05:39 PM
Last Post: nilamo
  [PyGame] Collision in not happening onizuka 3 3,455 Sep-07-2020, 11:30 AM
Last Post: metulburr
  [PyGame] No collision detection onizuka 6 3,709 Aug-18-2020, 01:29 PM
Last Post: onizuka
  [PyGame] pygame, help with making a function to detect collision between player and enemy. Kris1996 3 3,390 Mar-07-2020, 12:32 PM
Last Post: Kris1996
  Problem with collision detection... michael1789 4 3,330 Nov-12-2019, 07:49 PM
Last Post: michael1789
  Pygame sprite not moving michael1789 1 2,876 Nov-10-2019, 03:54 AM
Last Post: michael1789

Forum Jump:

User Panel Messages

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