Creating and Moving Rectangles In Pygame - Beginner Tutorial

  Рет қаралды 26,644

Coding With Russ

Coding With Russ

Күн бұрын

Пікірлер: 37
@chigstardan7285
@chigstardan7285 Жыл бұрын
Just stumbled on your channel, it's way too underrated and deserves more views and subscribers!
@CodingWithRuss
@CodingWithRuss Жыл бұрын
Thanks! :)
@Sirbozo
@Sirbozo 7 ай бұрын
ye
@falkerhard
@falkerhard 2 ай бұрын
Thank you for this. It is better than any python book I have read so far.
@CodingWithRuss
@CodingWithRuss 2 ай бұрын
Glad you found it useful!
@joshuabarqueesimeth4530
@joshuabarqueesimeth4530 16 күн бұрын
obviously, since any python book wouldn't be teaching you about the library pygame, unless you buy a pygame book.
@mej0berr
@mej0berr Жыл бұрын
ive been stuck on rectangles for the whole day thank you very much
@CodingWithRuss
@CodingWithRuss Жыл бұрын
Glad it helped :)
@angelhc4757
@angelhc4757 Жыл бұрын
your videos gives me an epic beginning for videogames! you're a hero :,)
@CodingWithRuss
@CodingWithRuss Жыл бұрын
Thanks, glad the videos help :)
@yourboizach9681
@yourboizach9681 Жыл бұрын
Absolutely brilliant man, your pygame tutorials are hard carrying me right now haha.
@CodingWithRuss
@CodingWithRuss Жыл бұрын
Glad I could help!
@mariamsalim894
@mariamsalim894 Жыл бұрын
Thanks a lot for the tutorial it helped a lot. However, how can I make the rectangle transparent because I have an image bg and not a color bg. I only want to see the soldier.
@CodingWithRuss
@CodingWithRuss Жыл бұрын
In this case you wouldn't need to draw the rectangle with pygame.draw.rect. You can miss that out and the rectangle won't be visible but it will still be there to be used for collision and positioning.
@CodingWithRuss
@CodingWithRuss Жыл бұрын
For the source code used in this tutorial, head over to my website: www.codingwithruss.com/pygame/working-with-rectangles-in-pygame/
@Thrawien
@Thrawien Жыл бұрын
Can you code character movement controlled by a mouse click in pygame? Like what would be used in a point and click adventure? Ive looked around for guides but I’ve struggled to understand the answers in stackoverflow as im a relative beginner
@CodingWithRuss
@CodingWithRuss Жыл бұрын
That's a good idea, I hadn't actually tried that before although I have made elements of that separately (aiming at the mouse and taking mouse input) before so should be something I could combine. I'll add it to the list of video topics and see if I can put together a tutorial for something like that, but it may be a little while yet as I've got a few other tutorials I'm working on already.
@Thrawien
@Thrawien Жыл бұрын
@@CodingWithRuss that would be incredible. Ive really enjoyed your tutorials you have a great way of explaining things. Especially to beginners like me! I feel like I can try to do a couple of practice projects now. Finally put my pixel art to use!
@LoganadoLakings
@LoganadoLakings Жыл бұрын
What is the difference between pygame.display.flip() and pygame.display.update()
@CodingWithRuss
@CodingWithRuss Жыл бұрын
There's very little difference in most applications. Check out the docs for a detailed explanation of how .update differs from .flip: www.pygame.org/docs/ref/display.html#pygame.display.update
@LoganadoLakings
@LoganadoLakings Жыл бұрын
@@CodingWithRuss Oh ok makes sense now thank you
@firej19
@firej19 11 ай бұрын
I know it's a little bit after the video was uplaoded, but should I use classes or rectangles?
@CodingWithRuss
@CodingWithRuss 11 ай бұрын
You can use both, it depends on the application. If it is just a rectangle to use for visual purposes then a rect is fine, but if you want to use it in a game as a character or an object that has movement and collision etc then it would be better to use a class and put a rectangle inside the class.
@firej19
@firej19 11 ай бұрын
@CodingWithRuss Great thank you so much
@leorachid41
@leorachid41 4 ай бұрын
Great job
@CodingWithRuss
@CodingWithRuss 4 ай бұрын
Thanks :)
@RakloRakloRaklo
@RakloRakloRaklo 6 ай бұрын
Hi, I don't know if you're still answering those, but is it possible to change the size of the rectangle after it has already been drawn, such as when I press a certain button?
@sdjukfoisdhfuoishdfjsdoifjksdj
@sdjukfoisdhfuoishdfjsdoifjksdj 4 ай бұрын
possible. just change the hight or width.
@ajeetsn240
@ajeetsn240 27 күн бұрын
you can by update
@carl6402
@carl6402 9 ай бұрын
Hey can i ask why is my player/character is duplicating when i moved. Or am i shouldn't delete the pygame.draw.rect first? (btw i have background on it)
@TToastedG
@TToastedG 9 ай бұрын
Did you put pygame.display.flip() at the end of your loop?
@carl6402
@carl6402 9 ай бұрын
@@TToastedG yes i did
@ImWatchinYou
@ImWatchinYou Жыл бұрын
Why attach the image to the rect instead of just controlling the image location directly?
@CodingWithRuss
@CodingWithRuss Жыл бұрын
It's ok to position the image directly for simpler applications but generally you will be relying on the rectangle for collision checks as well, so drawing the image over it allows you to do that.
@KtheSoulmate
@KtheSoulmate 3 ай бұрын
Thanks from Algeria
@joshuabarqueesimeth4530
@joshuabarqueesimeth4530 16 күн бұрын
what is the point of saying rect_1 instead of rect1, it wastes time to type a _
@joshuabarqueesimeth4530
@joshuabarqueesimeth4530 16 күн бұрын
and you don't need to type == true when checking for a key pressed, the if statement itself checks for true already, if you want to check for false, you say if not key[pygame.key].
Collisions in Pygame - Beginner Tutorial
10:59
Coding With Russ
Рет қаралды 55 М.
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН
2 YEARS of PYTHON Game Development in 5 Minutes!
4:54
Coding With Russ
Рет қаралды 990 М.
Cameras in Pygame
1:13:21
Clear Code
Рет қаралды 125 М.
Voxel Engine Demo in OpenGL [C++]
8:13
Carbone Dev
Рет қаралды 735
HOW TO MAKE A MENU SCREEN IN PYGAME!
5:09
baraltech
Рет қаралды 149 М.
Get Started in Pygame in 10 minutes!
10:19
Coding With Russ
Рет қаралды 389 М.
Python / Pygame tutorial: Getting text input
16:36
Clear Code
Рет қаралды 78 М.
PyGame Beginner Tutorial in Python - Adding Buttons
18:55
Coding With Russ
Рет қаралды 178 М.
PyGame Beginner Tutorial in Python - Infinite Scrolling Background
12:35
Coding With Russ
Рет қаралды 52 М.