Pygame Images with Sprite Sheet - Pygame RPG Tutorial #4

  Рет қаралды 19,142

ShawCode

ShawCode

Күн бұрын

In this pygame image tutorial, I show you how to use pygame images with a pygame spritesheet! This pygame sprite sheet tutorial shows you how to load images in using pygame.image.load, and then display them on a surface using pygame blit.
DOWNLOAD THE IMAGES: www.mediafire....
This is the 4th tutorial in the Pygame RPG tutorial series, and in the next video we are going to learn how to do pygame image animation, and pygame spritesheet animation as well!
Share this video: • Pygame Images with Spr...
Thanks for watching!

Пікірлер: 69
@boneitch
@boneitch Жыл бұрын
Absolutely love this series! It's well structured, and immediately gets to the point. Thank you!
@ShawCode
@ShawCode Жыл бұрын
Glad you're finding it useful!
@railgundotenc8538
@railgundotenc8538 3 жыл бұрын
Keep it up ! I’ve been looking for a series that actually uses spreadsheets!
@ShawCode
@ShawCode 3 жыл бұрын
Thanks :D
@jakecastle4426
@jakecastle4426 3 жыл бұрын
Dude, youre killing it man. +1 sub! Have you considered the new 3d game engine Ursina? Id watch a series on that
@ShawCode
@ShawCode 3 жыл бұрын
Thanks for subscribing! I hadn't actually heard of Ursina, but it looks interesting!
@jaylsont
@jaylsont 3 жыл бұрын
Very, Good!! Congratulations! I'm looking forward to the collision class
@ShawCode
@ShawCode 3 жыл бұрын
Thanks, the next tutorial will be out today!
@stementhusiast816
@stementhusiast816 3 жыл бұрын
Thanks for the tutorial. This is helpful for my next coding project. Much appreciated. Keep the quality coming.
@ShawCode
@ShawCode 3 жыл бұрын
Glad it helped!
@daniellotmo3404
@daniellotmo3404 Жыл бұрын
You explained this really well. Thanks a lot! Will definitely check out yor other videos
@primis9770
@primis9770 5 ай бұрын
Absolutely love the video this series is super helpful. I do have one question though: how do you know the coordinates in the spritesheet png to use in your function call? Opening the image doesn't show me the pixel locations
@Tcrrxzz
@Tcrrxzz 7 ай бұрын
Thank you so much for curing my boredom!
@pasta7697
@pasta7697 Жыл бұрын
If I want to insert a background rather than tiles, what should I do? Do you have any videos that describes this?
@itschris1881
@itschris1881 3 жыл бұрын
thank you for all your great videos man, goodluck
@ShawCode
@ShawCode 3 жыл бұрын
I'm glad you like them, thanks!
@itschris1881
@itschris1881 3 жыл бұрын
@@ShawCode thanks bro ur always welcome
@itsveno6533
@itsveno6533 2 жыл бұрын
Thank you so much for all of the tutorials they have been super helpful! If I want to change just part of the ground to look different for example adding a path, how would I go about that? I understand how to add higher layers but they are things you run into and I want to be able to add a walking path to my game.
@ShawCode
@ShawCode 2 жыл бұрын
You could create another class for the Path which inherits from the ground class. In the Path class, change the image to whatever you want it to be. Then, add the path into the tilemap. If you need any help doing this, let me know!
@itsveno6533
@itsveno6533 2 жыл бұрын
@@ShawCode I got it to work, thank you very much!
@kubnika2007
@kubnika2007 4 ай бұрын
Hey shawCode, how should i center the tilemap? i will have multiple maps and they are different by size
@radspazman22
@radspazman22 Жыл бұрын
Love the content! May I ask which color scheme you are using? I want it!
@Betruet
@Betruet 3 жыл бұрын
Awesome video, I learned alot..... and now to try it myself :)
@ShawCode
@ShawCode 3 жыл бұрын
Thanks :D
@StephanLiebenberg
@StephanLiebenberg Жыл бұрын
Quick help, I need to type in the whole directory from the drive letter before It loads the image, but I see you type in only from the project folder on. Any idea what I'm doing wrong? I'm using VS code BTW.
@alicemystery5520
@alicemystery5520 3 жыл бұрын
nice, did you make the sprites yourself as well ?
@ShawCode
@ShawCode 3 жыл бұрын
I got them off of the internet, but then I changed them a bit to fit our tilesize and to make them look a bit different.
@daleharrison3774
@daleharrison3774 2 жыл бұрын
I can’t get the ground to work it keeps saying TypeError add() argument after * must be iterable, not Game
@dantom2843
@dantom2843 3 жыл бұрын
Thanks for the help man! When is your next video going to come out? I need these videos ASAP! (for a school project lol)
@ShawCode
@ShawCode 3 жыл бұрын
It will be out this weekend - I do one video each week!
@dantom2843
@dantom2843 3 жыл бұрын
@@ShawCode Awesome. Keep it up!! :D
@somebody-8-pie
@somebody-8-pie 2 жыл бұрын
How do you find the position of the tiles in the terrain tileset?
@vijaysamant2864
@vijaysamant2864 5 ай бұрын
The link to images is not working, can someone help me please??
@kasperlarsson-skauli9246
@kasperlarsson-skauli9246 2 жыл бұрын
I was wondering, when writing "self.image.set_colorkey((BLACK))", you make all the black in the image transparent. Are there any other ways of removing the black square if my character contains black aswell? Thanks a lot!
@ShawCode
@ShawCode 2 жыл бұрын
You could just change the black in the character asset to a slightly lighter colour, for example (1,1,1). I don't think it would be noticeable!
@KuroVT
@KuroVT Жыл бұрын
I found a way to use transparent backgrounds in the spritesheet, so far it works : def get_sprite(self, x, y, width, height): sprite = pygame.Surface((width, height), pygame.SRCALPHA)
@MedTech1
@MedTech1 3 жыл бұрын
cool video 👍👍👍
@ShawCode
@ShawCode 3 жыл бұрын
I'm glad you found it useful!
@alicemystery5520
@alicemystery5520 3 жыл бұрын
ok i am getting this error in VS Code: pygame.error: Couldn't open img/character.png the stack overflow fix i tried did not work but it seems to do with my windows using \ which i do not understand.
@ShawCode
@ShawCode 3 жыл бұрын
Did you save the image from the description in the 'img' folder?
@alicemystery5520
@alicemystery5520 3 жыл бұрын
@@ShawCode yes i did.
@alicemystery5520
@alicemystery5520 3 жыл бұрын
i think i have a path wrong
@alicemystery5520
@alicemystery5520 3 жыл бұрын
i'll go over 4 again and make sure i have the code right
@alicemystery5520
@alicemystery5520 3 жыл бұрын
ok i did something wrong with the code. now everything but the character shows up
@Metsysllifer
@Metsysllifer 3 жыл бұрын
I have a question.......how to increase the size of the image? Thank you.....
@ShawCode
@ShawCode 3 жыл бұрын
Check out this link: stackoverflow.com/questions/20002242/how-to-scale-images-to-screen-size-in-pygame
@Metsysllifer
@Metsysllifer 3 жыл бұрын
@@ShawCodeThank you...
@spah_tf2
@spah_tf2 3 ай бұрын
im having a problem. on this part of the code" self.image = self.game.terrian_spritesheet.get_sprite(960, 448, self.width, self.height) self.rect = self.image.get_rect()" its saying i have an error, AttributeError: 'NoneType' object has no attribute 'get_rect' any idea why this is? edit: this happened when making the character, but when i made the rock the rock was the one with the problem. i went ahead into to the video, and now the ground has a problem edit 2: found the problem when rewatching, i missed seconds 5:55 - 6:30
@Doughnut445
@Doughnut445 3 жыл бұрын
How can I make the blocks in the middle a different block than the edges?
@ShawCode
@ShawCode 3 жыл бұрын
When you set self.image in the Block class, you could pass in a parameter choosing which image it is going to be. Then, if the item in the tilemap is 'A' for example, create a Block and pass in one image. If the item is 'B', then create a block and pass in a different image. Let me know if you need more help!
@Doughnut445
@Doughnut445 3 жыл бұрын
@@ShawCode thank you very much!! I will have to try this after work. What an inspiration you are.
@avtar7406
@avtar7406 3 жыл бұрын
From where do you learn coding . although you teach really gratifying.
@ShawCode
@ShawCode 3 жыл бұрын
I just learned from internet tutorials, like these ones!
@avtar7406
@avtar7406 3 жыл бұрын
That's awesome.beside of this how many languages does you know.and if you know how to code in html please make tutorial on that because i only know advance Java and has just, done python.
@ShawCode
@ShawCode 3 жыл бұрын
@@avtar7406 I know Python, Java and Javascript, as well as a tiny bit of C++. There are plenty of resources on the internet to learn HTML!
@avtar7406
@avtar7406 3 жыл бұрын
That's awesome bro. You know three languages.i really want to share your videos to my friends but as they are from India they can't understand your accent so if possible try to add captions so they can also understand, although waiting for your next video love from aus.
@jaysikotar9860
@jaysikotar9860 3 жыл бұрын
🤩♥
@ShawCode
@ShawCode 3 жыл бұрын
:D
@achillariouss5698
@achillariouss5698 3 жыл бұрын
How do i run the code in sumbline???
@MedTech1
@MedTech1 3 жыл бұрын
ctrl + b
@ShawCode
@ShawCode 3 жыл бұрын
Yes, Ctrl + B is the keybind to run it.
@dantom2843
@dantom2843 3 жыл бұрын
Command + B if on MacOS
@JuusK
@JuusK 2 жыл бұрын
2:04
Pygame Collision Detection - Pygame RPG Tutorial #5
7:19
ShawCode
Рет қаралды 14 М.
Cameras in Pygame
1:13:21
Clear Code
Рет қаралды 119 М.
Worst flight ever
00:55
Adam W
Рет қаралды 7 МЛН
МЕБЕЛЬ ВЫДАСТ СОТРУДНИКАМ ПОЛИЦИИ ТАБЕЛЬНУЮ МЕБЕЛЬ
00:20
Magic or …? 😱 reveal video on profile 🫢
00:14
Andrey Grechka
Рет қаралды 86 МЛН
小丑妹妹插队被妈妈教训!#小丑#路飞#家庭#搞笑
00:12
家庭搞笑日记
Рет қаралды 36 МЛН
Pygame Animation with Sprite Sheets
11:38
Paget Teaches...
Рет қаралды 75 М.
Pygame Sprites And Groups Explained!
5:56
Coding With Russ
Рет қаралды 42 М.
Pygame Tile Based Game Tutorial: Tilemaps
11:27
CDcodes
Рет қаралды 53 М.
Pygame Tilemap - Pygame RPG Tutorial #3
12:33
ShawCode
Рет қаралды 21 М.
Python Pygame Tutorial - Sprite Sheets
14:01
code.Pylet
Рет қаралды 32 М.
How to Create and Animate Sprite Sheets in Python Using PyGame!
32:45
ASMR Programming - Spinning Cube - No Talking
20:45
Servet Gulnaroglu
Рет қаралды 3,9 МЛН
Worst flight ever
00:55
Adam W
Рет қаралды 7 МЛН