Where do I save my images to be able to access them within python. When I tried to load my images it said that they weren’t saved in the same directory, can you explain that to me?
Thank you Mr.Russ for your passionate effort. I'm a South Korean and used to be a teacher of English. Due to your devotion I am very happy to study game code though old (born in 1953)
Hi, glad to hear you are watching the videos and finding them useful. Never too old to learn :) If you have any trouble with the code then ask in the comments and I will try to help. I also upload the code on github (in the video description) so you can always check that if there are any errors in the code
I can't believe im done with part 8 honestly, its been amazing completing this tutorial. Even when I am tired from work I still want to keep staying up to keep watching lol
this tutorial series only gets better. amazing work, Russ. I watched your "Ultimate pygame intro" at clear code a couple of months ago and it taught me a lot, and for sure helped me to understand these tutorials very easily. huge fan of your work!
you deserve plenty more attention, these tutorials have inspired me to create my own games and still do after a year watching you, very easily to follow along and learn all the logic behind the game
Love this playlist! Watching you has helped me alot... However two things I have no figured out yet is : 1) How to limit the ai from "seeing the player through a block" 2) how to keep the ai from walking off the end of a platform.
Thanks! The AI is fairly basic so both of those things could be added in. I considered them when initially making the game but didn't want the code to get too complicated. I had some ideas for how to implement those features though, if you want to try and add them in: 1)The AI "vision" only checks for collision with the player, but instead it could also check for collision with all tiles. Then by checking the distances to the objects in the AI's vision (player or tiles), you can determine whether the player is behind a wall or in front of it. 2) The AI already has a section for doing a collision check with tiles in front of it and it turns around if it detects that. So you could do a similar check for an earth tile under the AI so if it there is no tile in front to stand on, it turns around
Yea that is going to be done in the next couple of videos. I wanted to get everything else working first with the player and enemies etc, which is nearly done now
Man per usual great stuff I am now pausing and writing code and testing my way and I am not far off of the way you are doing it but..... I always revert to your way just so I am following along :) 10 thumbs up my friend
@@CodingWithRuss yes thanks to you I am getting a clearer approach on things I just need to start making my brain think about logic to help me know what I need and what to add ... You rock man
Great tutorial, I recently discovered your channel because I procrastinated for a school project, and for what I had in mind I used a few aspects from the platformer game and was able to do quite well. So I hereby thank you. Another thing is that, pygame is really well done. For example the draw "functions" etc. are super simple and I think your tutorials make pygame simple and intuitive. (Sorry if this comment isn't that well written I'm short on time atm :P)
There is a problem in mine. Whenever i enter the enemies vision, they always die and never shoot. I tried making sure that every line was correct but the error kept happening. Is there a way to fix this?
Can you make a tutorial where if the enemy died we can update point / record, or even better that they drop item after they died. I tried to do it myself but i got into an infinity loop since i dunno where to put a stop / or run just once my update record method. Thanks
Hello Russ, it's cool that player and enemies have the same class, but what if I want to add another type of enemies, like tank or mech, how different will it be from standard soldier? Or would it be easier to make a separate class for them?
Hey adding self.Updateanimaitons(0) seems to cause my code to crash whenver I idle but it seems my code is the same as yours im confused why this is causing an issue. I managed a fiix for it but Inow once you adding shooting i got the same error: TypeError: updateAnimations() takes 1 positional argument but 2 were given
Hi, again! I was wondering how to deal with "invisible" hitboxes on pygame. There's a blank space around my player and my enemies, and since I have a tile-based collision on them, collisions get messed up by that. Is there maybe a built-in pygame function that ignores the blank space and checks for collision only for the image part of the rectangle?
Hello. Yes there is functionality for that in pygame. it's done using masks. I don't have a tutorial specifically on masks but I have used them once on a previous project, which may help you: ruclips.net/video/t1zTvpxHKCU/видео.html
@@CodingWithRuss Thank you for getting back to me! The video explains masks really good. Does it still work with tile-based collisions? My player's collision with ground tiles also gets affected by the blank rectangle, but I can't stop using tile-based collision in that instance. How would this get fixed?
i was following the tutorial and was having trouble with adding the enemy into a group. when i added them i was only able to hit 1 enemy and no more. Can you help?
when I call the "ai" function on the enemys for some reason it affects the player's jump, it makes it low and fast! and the enemys doesn't have any gravity...
the ai_moving_left = not ai_moving_right is causing me some trouble its giving me this error UnboundLocalError: local variable 'ai_moving_right' referenced before assignment how do i fix this? thanks for the help
It means you haven't defined (created) the variable ai_moving_right yet. Compare against the complete code for this section and see if you have any missed code or a typo for ai_moving_right
Did you find the fix? It sounds like you have a typo in the code and the enemy's self.health is lowering rather than the target. Check the code linked in the description to see what it should be like
i wanted my enemies to stop only when they reach to the ends also i wanted their momement to be random so i changed my ai class to this def ai(self): if self.alive and player.alive: #check if the ai in near the player if self.vision.colliderect(player.rect): #stop running and face the player self.update_action(0)#0: idle #shoot self.shoot() else: if self.idling == False: if self.direction == 1: ai_moving_right = True else: ai_moving_right = False ai_moving_left = not ai_moving_right self.move(ai_moving_left, ai_moving_right) self.update_action(1)#1: run self.move_counter += 1 #update ai vision as the enemy moves self.vision.center = (self.rect.centerx + 75 * self.direction, self.rect.centery) if self.move_counter > TILE_SIZE: self.update_action(0)#0: idle self.idling = True self.idling_counter = random.randint(75,200) #this is min, max time for the enemies to stop at the ends self.direction *= -1 self.move_counter *= -1 else: self.idling_counter -= 1 if self.idling_counter
does anyone here use sublime text for python? if yes then please can u tell me how to enable python cuz it always shows some error to me while I use sublime for python...Help me please and yes amazing tutorial as always and AI is new this time in the game so i love it
Part 9 is now uploaded and I show how to load levels into the game: ruclips.net/video/5VSzZu5904c/видео.html
Where do I save my images to be able to access them within python. When I tried to load my images it said that they weren’t saved in the same directory, can you explain that to me?
Thank you Mr.Russ for your passionate effort.
I'm a South Korean and used to be a teacher of English.
Due to your devotion I am very happy to study game code though old (born in 1953)
Hi, glad to hear you are watching the videos and finding them useful. Never too old to learn :) If you have any trouble with the code then ask in the comments and I will try to help. I also upload the code on github (in the video description) so you can always check that if there are any errors in the code
I've never seen a tutorial that's fun and educational at the same time. this guy is a legend. keep it up!
Thanks a lot, glad you liked it!
I can't believe im done with part 8
honestly, its been amazing completing this tutorial.
Even when I am tired from work I still want to keep staying up to keep watching lol
Nice! You are flying through it :)
Clever workouround for enemy's vision and ai in general, this is great material, thanks a lot you're awesome Russ
Thanks, I had a few different ideas for it but that was the solution I was happiest with!
this tutorial series only gets better. amazing work, Russ. I watched your "Ultimate pygame intro" at clear code a couple of months ago and it taught me a lot, and for sure helped me to understand these tutorials very easily. huge fan of your work!
you deserve plenty more attention, these tutorials have inspired me to create my own games and still do after a year watching you, very easily to follow along and learn all the logic behind the game
Thank you! I'm glad to hear the tutorials are still useful
@@CodingWithRuss They are by far the best tutorials I have seen in anything coding related
Love this playlist! Watching you has helped me alot... However two things I have no figured out yet is :
1) How to limit the ai from "seeing the player through a block"
2) how to keep the ai from walking off the end of a platform.
Thanks! The AI is fairly basic so both of those things could be added in. I considered them when initially making the game but didn't want the code to get too complicated. I had some ideas for how to implement those features though, if you want to try and add them in:
1)The AI "vision" only checks for collision with the player, but instead it could also check for collision with all tiles. Then by checking the distances to the objects in the AI's vision (player or tiles), you can determine whether the player is behind a wall or in front of it.
2) The AI already has a section for doing a collision check with tiles in front of it and it turns around if it detects that. So you could do a similar check for an earth tile under the AI so if it there is no tile in front to stand on, it turns around
Great stuff again! I just did a small tweak to make it so you don't "pick up" the Health box when the player is at full HP. :-)
how XD
been working through these videos aha cant wait to see the final result
Good stuff! Hopefully all making sense so far.
@@CodingWithRuss When is part 9 coming out if you don't mind me asking?
@@HostileOTB Just uploaded it now :)
Can't wait for the scrolling background
Yea that is going to be done in the next couple of videos. I wanted to get everything else working first with the player and enemies etc, which is nearly done now
Man per usual great stuff I am now pausing and writing code and testing my way and I am not far off of the way you are doing it but..... I always revert to your way just so I am following along :)
10 thumbs up my friend
Glad to hear it! Working it out for yourself is definitely the best way so sounds like you've got a good approach to it :)
@@CodingWithRuss yes thanks to you I am getting a clearer approach on things I just need to start making my brain think about logic to help me know what I need and what to add ... You rock man
I cant believe that you just gave me the ability to create Metal Slug.
Thank you for the work u r doing Russ!
No problem, glad you like the videos :)
Congratulations. Your tutorials are perfect.
Thanks! Glad you like them
Works like a charm
Good stuff! Glad it is making sense
My man. U the bossss keep on it bro
Will do!!
Thank you very much friend, the tutorial has been very helpful to me. Keep up the good work.
Glad to hear that!
Great tutorial, I recently discovered your channel because I procrastinated for a school project, and for what I had in mind I used a few aspects from the platformer game and was able to do quite well. So I hereby thank you.
Another thing is that, pygame is really well done. For example the draw "functions" etc. are super simple and I think your tutorials make pygame simple and intuitive. (Sorry if this comment isn't that well written I'm short on time atm :P)
Thanks, glad to hear this helped with your project! 😀
@@CodingWithRuss thank you!
Great vid russ! thx
Thanks for the lesson!
You're welcome!
great. I like the vision solution. you can use elif too...
Thanks Giovanni, glad you liked it! And that is a good suggestion about elif.
I can build Many Projects by help of your Project, your project is very Intuitive. thanks for great content.
Thanks! Glad to hear it
Thank you o much for this dude. You are a God.
Hi dude I wanted to say thank you💖
No problem, I'm glad you liked the tutorial :)
I finish this part , finding that enemy's bullet can kill another enemy. Fun:D
Haha yup, friendly fire :)
There is a problem in mine. Whenever i enter the enemies vision, they always die and never shoot. I tried making sure that every line was correct but the error kept happening. Is there a way to fix this?
Thank you Mr Russ for the tutorials
Finally !!!!!
huge thanks
You're welcome
FAB THANKS
Can you make a tutorial where if the enemy died we can update point / record, or even better that they drop item after they died. I tried to do it myself but i got into an infinity loop since i dunno where to put a stop / or run just once my update record method. Thanks
i need help the vision cone is only active when the guy is idle and it flickers
I am unable to download the scv file
But thanks to publish this vedio
What should I do if the enemies use different
bullet image than the player?
Hello Russ, it's cool that player and enemies have the same class, but what if I want to add another type of enemies, like tank or mech, how different will it be from standard soldier?
Or would it be easier to make a separate class for them?
I assume the images and info in the enemy = Soldier () line would change.
Good ider 👍
Thank you!
Hey adding self.Updateanimaitons(0) seems to cause my code to crash whenver I idle but it seems my code is the same as yours im confused why this is causing an issue. I managed a fiix for it but Inow once you adding shooting i got the same error: TypeError: updateAnimations() takes 1 positional argument but 2 were given
Hi, again! I was wondering how to deal with "invisible" hitboxes on pygame. There's a blank space around my player and my enemies, and since I have a tile-based collision on them, collisions get messed up by that. Is there maybe a built-in pygame function that ignores the blank space and checks for collision only for the image part of the rectangle?
Hello. Yes there is functionality for that in pygame. it's done using masks. I don't have a tutorial specifically on masks but I have used them once on a previous project, which may help you: ruclips.net/video/t1zTvpxHKCU/видео.html
@@CodingWithRuss Thank you for getting back to me! The video explains masks really good. Does it still work with tile-based collisions? My player's collision with ground tiles also gets affected by the blank rectangle, but I can't stop using tile-based collision in that instance. How would this get fixed?
i was following the tutorial and was having trouble with adding the enemy into a group. when i added them i was only able to hit 1 enemy and no more. Can you help?
when I call the "ai" function on the enemys for some reason it affects the player's jump, it makes it low and fast! and the enemys doesn't have any gravity...
NVM I fixed it, I accidentally typed player.vel_y in the move function! now the jump is good and the gravity works good!!!! GOD TUTORIALS🔥🔥🔥🔥
@@opst1x89 Good to hear you got it fixed, it is often these little typos that cause headaches! :)
the ai_moving_left = not ai_moving_right is causing me some trouble
its giving me this error UnboundLocalError: local variable 'ai_moving_right' referenced before assignment
how do i fix this? thanks for the help
i found the problem, i just made a typo lol
It means you haven't defined (created) the variable ai_moving_right yet. Compare against the complete code for this section and see if you have any missed code or a typo for ai_moving_right
The enemy takes the dmg and dies when it attacks me(the player) instead of other way around, how could I fix this?
Did you find the fix? It sounds like you have a typo in the code and the enemy's self.health is lowering rather than the target. Check the code linked in the description to see what it should be like
@@CodingWithRuss I found the fix thank you!
@@connorganahl2694 What was the fix?
i wanted my enemies to stop only when they reach to the ends also i wanted their momement to be random so i changed my ai class to this
def ai(self):
if self.alive and player.alive:
#check if the ai in near the player
if self.vision.colliderect(player.rect):
#stop running and face the player
self.update_action(0)#0: idle
#shoot
self.shoot()
else:
if self.idling == False:
if self.direction == 1:
ai_moving_right = True
else:
ai_moving_right = False
ai_moving_left = not ai_moving_right
self.move(ai_moving_left, ai_moving_right)
self.update_action(1)#1: run
self.move_counter += 1
#update ai vision as the enemy moves
self.vision.center = (self.rect.centerx + 75 * self.direction, self.rect.centery)
if self.move_counter > TILE_SIZE:
self.update_action(0)#0: idle
self.idling = True
self.idling_counter = random.randint(75,200) #this is min, max time for the enemies to stop at the ends
self.direction *= -1
self.move_counter *= -1
else:
self.idling_counter -= 1
if self.idling_counter
does anyone here use sublime text for python? if yes then please can u tell me how to enable python cuz it always shows some error to me while I use sublime for python...Help me please and yes amazing tutorial as always and AI is new this time in the game so i love it
i use sublime text, but for me it came with python preinstalled. i dont really know how to help you sorry
I can only thank...
You're welcome, glad you like the tutorial :)
There a bug in this game
🧑💻