Pygame Top Down Shooter Tutorial #1 - Player Setup

  Рет қаралды 36,779

ScriptLine Studios

ScriptLine Studios

Күн бұрын

Пікірлер: 89
@nickbubuioc
@nickbubuioc 3 жыл бұрын
Just found your videos... you are the only 1 who explain things so well and i can understand , thank you
@ScriptLineStudios
@ScriptLineStudios 3 жыл бұрын
Happy to hear that! Thanks for the motivation :D
@shapeletter
@shapeletter 2 жыл бұрын
Nice video, good tempo! :) For the scrolling bullets, you could store the display_scroll as old_display_scroll when you create the bullet, and then... `bullet.x = old_display_scroll[0] - display_scroll[0] + travel_distance_x`
@seanbisset4750
@seanbisset4750 3 жыл бұрын
Dude how old are you?? I'm 31 still learning and I'm in awe on youngsters who are so competent in code!! I wish I had learnt it when I was young.
@ScriptLineStudios
@ScriptLineStudios 3 жыл бұрын
I am 14 but don't worry I believe its never too late to start!
@pygame5936
@pygame5936 3 жыл бұрын
@@ScriptLineStudios i am 12 i am still learning but need so much to learn ,,,,, cool toturials bro
@oubracode
@oubracode 3 жыл бұрын
@@pygame5936 me to loll haha
@Superfastisfast
@Superfastisfast 3 жыл бұрын
@@ScriptLineStudios hi I’m 9 (: guess we’re close
@The.Radiance
@The.Radiance 2 жыл бұрын
@@ScriptLineStudios same bro
@legendrags
@legendrags 2 жыл бұрын
thank you so much, i was searching for how to move the bullet in any direction. You helped me a lot!
@itspyguru
@itspyguru 3 жыл бұрын
Whoaaa, amazing work buddy 👏👏👏
@DevNugget
@DevNugget 3 жыл бұрын
Looking at the first few minutes of the video, seems like a great tutorial.. I will save this for later because im definitely going to be trying pygame soon!
@ScriptLineStudios
@ScriptLineStudios 3 жыл бұрын
Good luck with Pygame! Once again thanks for the awesome thumbnail!
@DevNugget
@DevNugget 3 жыл бұрын
@@ScriptLineStudios 👍
@lunar8258
@lunar8258 Жыл бұрын
when i shoot the bullet sometimes it creates a line on my screen, why is that?
@RoboMarchello
@RoboMarchello 3 жыл бұрын
Great tutorial! When you speak while coding it relaxes me XD
@ScriptLineStudios
@ScriptLineStudios 3 жыл бұрын
Thank you! Glad you enjoyed :D
@justalunatic
@justalunatic 3 жыл бұрын
8:20 - um.. what WAS THT " hm aahahe"
@TheChristIsKing
@TheChristIsKing 3 жыл бұрын
Looking forward to part 2. I'm going to use this to teach my 6 yo son. Thank you!
@ScriptLineStudios
@ScriptLineStudios 3 жыл бұрын
Thank you! I hope he enjoys it :D Part 2 should be coming this weekend
@oubracode
@oubracode 3 жыл бұрын
@@ScriptLineStudios You DOING Really Good work, KEEP GOING!!!
@PurpleGecko6
@PurpleGecko6 6 ай бұрын
Love the video, you have earned my sub
@sorzak_kriv8143
@sorzak_kriv8143 2 жыл бұрын
there should be a volume button for keyboards great tutorial tho!
@rinkaudenaerde8242
@rinkaudenaerde8242 3 жыл бұрын
i have a problem. when i click, the game ends. how do i fix this?
@peterheile7739
@peterheile7739 2 жыл бұрын
Thank you so much! This really helped me get started and understand the basic so hopefully I can do well on my creations in the future!
@Acrowbatics100
@Acrowbatics100 3 жыл бұрын
I WAS LOOKING FOR THIS!!!! KEEP UP GOOD WORK
@birbylikesfox1032
@birbylikesfox1032 3 жыл бұрын
amogus
@kazurapozdro
@kazurapozdro 3 жыл бұрын
how do you make like a smooth camera follow? like a delay and smooth follow back to the player
@nowifi3266
@nowifi3266 2 жыл бұрын
Amazing, just what I needed, ty!
@niilokolehmainen3453
@niilokolehmainen3453 2 жыл бұрын
Good video! If there is something you should make better it is you keyboard voice.
@mitchelljones2452
@mitchelljones2452 Жыл бұрын
I'm running into a bug where anytime I shoot a ball off the left side of the screen, the ball stretches across the screen making a line. I've had this happen on a couple different codiing projects and can never figure out why, has anyone else run into this problem?
@ryanbaybutt2134
@ryanbaybutt2134 Жыл бұрын
Yeah i got the same problem ??. I just added an if statement at the end of the game loop where the bullets for loop is, if bullet.x < 25: player_bullets.remove(bullet) makes it work better but still really weird.
@furtnite3913
@furtnite3913 Жыл бұрын
@@ryanbaybutt2134why does it work now? Why 25
@edward2908
@edward2908 3 жыл бұрын
Fuckin hell the red cube is shooting my sprite
@creativedogeMC
@creativedogeMC 3 жыл бұрын
Almost to 1000 subs! LET'S GOOOOOOOOOOOOOOOO
@mlody4ever
@mlody4ever 2 жыл бұрын
for screen resolution i reccomend this code: HEIGHT = 1280 WIDTH = 720 It's easier to understand, and with that knowledge you can define custom screen resolution, that player can easily input in game options or via debug console.
@fumano2679
@fumano2679 2 жыл бұрын
My screen has only 1080 height and not 1280 😭
@awesomegamercz
@awesomegamercz Жыл бұрын
I'm having an issue like the one described in some of the other comments. Any time I fire a bullet to the left side of the screen, that whole line will fill with the bullet.
@furtnite3913
@furtnite3913 Жыл бұрын
Have you fixed it? Same problem here
@siriuslemaitre4833
@siriuslemaitre4833 3 жыл бұрын
"pygame.Surface' object attribute 'scroll' is read-only" this is a message i've got when I run the game for this line of script : display.scroll = [0,0] can someone help me?
@ScriptLineStudios
@ScriptLineStudios 3 жыл бұрын
Looks like you have accidentally said display.scroll instead of display_scroll :D
@siriuslemaitre4833
@siriuslemaitre4833 3 жыл бұрын
@@ScriptLineStudios OMG thanks you so much its been one day i'm searching for the solution xD
@dekriel119
@dekriel119 2 жыл бұрын
width and height and speed not defined?
@tranzistor4093
@tranzistor4093 2 жыл бұрын
Your keyboard is best!
@hiddebeast5166
@hiddebeast5166 Жыл бұрын
i cant change the color
@AeSoG_Youtube
@AeSoG_Youtube Жыл бұрын
SOurce?
@siriuslemaitre4833
@siriuslemaitre4833 3 жыл бұрын
very interesting tutorial, but the sound of your keyboard is a little annoying o~o. great video, continue in this way!
@ScriptLineStudios
@ScriptLineStudios 3 жыл бұрын
Thanks for the feedback :D
@catloafl
@catloafl 2 жыл бұрын
The code for exiting at 3:09 is wrong, you want to use pygame.quit() to run exiting the app, the only reason why it closes properly is because you have sys.exit(), so pygame.QUIT does nothing for actually closing the app. Also you don't need sys to exit the pygame window, you just need to use pygame.quit() (all lowercase, the UPPERCASE pygame.QUIT is an event, while pygame.quit() is a method)
@---sb3sr
@---sb3sr 2 жыл бұрын
You still need sys.exit() to quit the program as pygame.quit() only leaves the game, the while loop will still go on.
@grimblegromble8469
@grimblegromble8469 2 жыл бұрын
I'm getting this error, and I cannot figure out how to solve it :( : line 45, in mouse_x, mouse_y == pygame.mouse.get_pos() NameError: name 'mouse_x' is not defined
@m-danya-327
@m-danya-327 2 жыл бұрын
Change the "==" to "=". Right now you're trying to check for equality (with "==") a tuple of two varibles (mouse_x, mouse_y) with the value of pygame.mouse.get_pos(), and Python tries to get the values of these variables, but they are not defined. You want to define them instead of doing all of these, so just use "="
@apexlegends3168
@apexlegends3168 2 жыл бұрын
Gets that fired bullets will always exist. You need to delete them after they go beyond the screen. Why don't you use groups instead of putting bullets in a simple list? for bullet in player_bullets: bullet.main(screen) if bullet.y < 0 or bullet.y > SCREEN_HEIGHT or bullet.x < 0 or bullet.x > SCREEN_WIDTH: del player_bullets[-1]
@fdevstudio5692
@fdevstudio5692 3 жыл бұрын
Hi, you know dafluffypotato?
@ScriptLineStudios
@ScriptLineStudios 3 жыл бұрын
Yes, they are one of my inspirations
@eobondarenko2753
@eobondarenko2753 3 жыл бұрын
Спасибо
@mopar_stolecar
@mopar_stolecar 2 жыл бұрын
How do I download pygame?!?
@sine7687
@sine7687 Жыл бұрын
It 's really useful.
@v69hz82
@v69hz82 3 жыл бұрын
Good tutorial, it's just that it's been 1 month since you uploaded the second part
@v69hz82
@v69hz82 3 жыл бұрын
can't wait for the second part xd
@hoimenam5381
@hoimenam5381 3 жыл бұрын
were can you get the pack?
@ScriptLineStudios
@ScriptLineStudios 3 жыл бұрын
Its in the description of the second part to this series :D
@hoimenam5381
@hoimenam5381 3 жыл бұрын
@@ScriptLineStudios ok thanks (:
@eyeofcthulhu526
@eyeofcthulhu526 2 жыл бұрын
it says pygame doesn't exist
@teo11300
@teo11300 Жыл бұрын
great tutorial!
@andrewcathcart
@andrewcathcart 3 жыл бұрын
Your intellisense looks pretty bad here. What IDE are you using? Seems like a pain not having decent autocomplete.
@v69hz82
@v69hz82 3 жыл бұрын
She's using ATOM
@jawas4181
@jawas4181 3 жыл бұрын
Bro, very good video.
@seansteusloff3918
@seansteusloff3918 3 жыл бұрын
hey, pretty new to coding, does anyone know what might be a common reason the white square wont move? Ik that's pretty vague but I cant figure it out and figured I might as well ask lol
@ScriptLineStudios
@ScriptLineStudios 3 жыл бұрын
Hey! could you maybe post your code here, would love to take a look and help you out
@seansteusloff3918
@seansteusloff3918 3 жыл бұрын
@@ScriptLineStudios yup! btw I really appreciate the help really cool of you! might look a little weird after the copy paste but here's what I have import pygame import sys import math pygame.init() display = pygame.display.set_mode((800, 600)) clock = pygame.time.Clock() class Player: def __init__(self, x, y, width, height): self.x = x self.y = y self.width = width self.height = height def main(self, display): pygame.draw.rect(display, (255, 0, 0), (self.x, self.y, self.width, self.height)) player = Player(400, 300, 32, 32) display_scroll = [0,0] while True: display.fill((24, 164, 86)) for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.QUIT sys.exit() keys = pygame.key.get_pressed() pygame.draw.rect(display, (255, 255, 255), (100-display_scroll[0], 100-display_scroll[1], 16, 16)) if keys[pygame.K_a]: display_scroll[0] -= 5 if keys[pygame.K_d]: display_scroll[0] += 5 if keys[pygame.K_w]: display_scroll[1] -= 5 if keys[pygame.K_s]: display_scroll[1] += 5 player.main(display) clock.tick(60) pygame.display.update()
@Nico-xs2lq
@Nico-xs2lq 3 жыл бұрын
@@seansteusloff3918 if u didnt understand, the problem may be because its an illusion, you are the middle square, if u look at it, its going to look like the middle square its moving, you welcome(maybe)
@mousiedev7883
@mousiedev7883 3 жыл бұрын
Bugs: Swap the lines sys.exit() and pygame.QUIT Change this ^ pygame.QUIT to pygame.quit() Cosmetic: The keyboard is pretty loud Video and sound out of sync Having global variables can result in badly managable code You should put the init stuff & main loop to its own function For the bullets, you can predict the trajectory of where they will go and just move it on the trajectory (might be overkill though)
@ScriptLineStudios
@ScriptLineStudios 3 жыл бұрын
Thank you for the feedback! I will fix the bugs and take your suggestions into account for part 2 of this series!
@mousiedev7883
@mousiedev7883 3 жыл бұрын
@@ScriptLineStudios no problem!
@papiangelus
@papiangelus 3 жыл бұрын
Ayo, where's the art assets lmao
@hoimenam5381
@hoimenam5381 3 жыл бұрын
i dont know ether
@mariozaldivar7802
@mariozaldivar7802 3 жыл бұрын
Great video!!!
@ScriptLineStudios
@ScriptLineStudios 3 жыл бұрын
Thank you!!
@jkewlo
@jkewlo 3 жыл бұрын
Got a subbbbbb from me
@ScriptLineStudios
@ScriptLineStudios 3 жыл бұрын
Thank you!!
@rangerconstruct3474
@rangerconstruct3474 Жыл бұрын
I have an issue where when I click above the player, the bullets fire from below, and vice versa. This is not an issue for when I click to the right or left of the player. I feel this is to do with the math.cos/math.y part, as when I change it, results differ but don’t fix.
@The.Radiance
@The.Radiance 2 жыл бұрын
My code is broken!! it gives me this error about the variable of speed being a tuple and not an integer File "/home/radioactivethirst/PyCode/zombiesurvival.py", line 55, in pistol_bullets.append(PistolBullet(player.x, player.y, mouse_x, mouse_y)) File "/home/radioactivethirst/PyCode/zombiesurvival.py", line 29, in __init__ self.x_vel = math.sin(self.angle) * self.speed TypeError: must be real number, not tuple What does this mean and how do I fix it?
@chairchair1231
@chairchair1231 2 жыл бұрын
instead of this just use vectors
Pygame Shooter Tutorial #2 - Animations, Weapons and Enemies!
25:31
ScriptLine Studios
Рет қаралды 15 М.
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 41 МЛН
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН
If You Can't Make Games After This Video...
4:37
Fredyy
Рет қаралды 1 МЛН
How to Make a 3D Game in Python from Scratch [ Pygame ]
16:14
Standalone Coder
Рет қаралды 274 М.
How I Added Shaders to Pygame
6:01
DaFluffyPotato
Рет қаралды 38 М.
PyGame Beginner Tutorial in Python - Infinite Scrolling Background
12:35
Coding With Russ
Рет қаралды 53 М.
How do non-euclidean games work? | Bitwise
14:19
DigiDigger
Рет қаралды 2,5 МЛН
Can I 100% Superliminal and Get a Refund?
23:36
Gronf
Рет қаралды 325 М.
Pygame RPG Tutorial #1 - Pygame Tutorial
19:31
ShawCode
Рет қаралды 103 М.
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 41 МЛН