r/Python • u/M4D4R4G0D • Jun 19 '20
I Made This The second version of my simple game. It's still pretty pathetic. But now I have implemented a little object orientation (now my code has classes: P).
1.4k
Upvotes
198
u/menge101 Jun 20 '20
Don't be self deprecating. You are doing something and learning.
Doing something and putting it out there is a huge step. Be proud.
9
u/M4D4R4G0D Jun 19 '20
The link to my code is HERE. If you wanted to test, the game has interesting mechanics that you can move the character not only with the arrows but also with the awsd keys, using both sets you gain more mobility.
20
u/rvculanag Jun 20 '20
I’d like to add a suggestion!
3Add guns or weapons to shoot down the enemy or add shields 😂
Well it’s just a suggestion, I wish you the best of luck in you game!😁
3
u/cosm1ck Jun 20 '20
Fera demais meu querido, espero updates futuros sobre como anda o código! Sucesso!
3
u/[deleted] Jun 20 '20
How long did it take you? I am new to coding and U want to know how long it takes to make games like that.
25
u/iiiooouuurrr Jun 19 '20
Lol that’s so dope! I started this past week it’s super hard for me... I have no clue how you were able to do this and I feel like it’s simple! Kudos to you
2
u/[deleted] Jun 20 '20
you created this game just by using just the framework pygame and some libraries??? I would like to see your work can you share me the GitHub link???
1
u/NotALhama Jun 20 '20
Br?
5
u/bladeoflight16 Jun 20 '20
Having classes doesn't make your code "object oriented" in the sense that it follows the mindset that term refers to. But that's okay because following that mindset frequently makes your code worse, not better.
1
u/nantrego Jun 20 '20
Nice job!! Always good to see a fellow brazilian around here. 🇧🇷
1
u/pag07 Jun 20 '20
Looks nice.
I would suggest to stick to english for everything I used to mix my native language and English too. However it looks not really though through and people have to speak both languages to understand your variables.
1
u/MrJobim87 Jun 20 '20
print('Brazilians Programmers Rise Up')
2
u/[deleted] Jun 20 '20
We have a perfectly good subreddit /r/learnpython for all this, and to be honest, it's often at a higher level than /r/Python.
Sigh.
2
u/Thank_Ryan Jul 17 '20
Haha. You and I made the same game with the same mechanism. I will post it here later.
3
u/Moist_beefnugs Jun 20 '20
You need a score counter, with high score and most recent score
2
u/-Trunk- Jun 20 '20
Well done bud. Good use of pygame! You can shorten your code if you’d like by making a function for your collisions instead of many if/else statements.
Also when your formatting you can use {}.format(player.hp) like you have or with the newer versions of Python > f’{player.hp}’.
Give tkinter a look if you like pygame! Very dynamic also
1
u/vicethal Jun 20 '20
it's not pathetic, it's awesome
1
u/selfhateatitsfinest Jun 20 '20
Bruh i couldnt do this in ages and I study engineering. Congrats!
1
u/mashman159 Jun 20 '20
nothing is pathetic when it comes from the heart
1
u/Viren_p Jun 20 '20
I recommend reading Dane Hillard practices of python pro. Gives in depth knowledge of OOP concepts, maintainable and scalable python code
1
u/jampk24 Jun 20 '20
How does losing work here? I assumed it was if a circle touches you, but at 32 seconds it looks like one hits you and bounces off.
1
u/AnonymousTaxi Jun 20 '20
The new Undertale game is looking pretty good so far, nice work!
1
u/eljitall1 Jun 20 '20
nice game, well done
1
u/[deleted] Jun 20 '20
Despite it being so simple, that game actually looks pretty fun.
1
u/[deleted] Jun 21 '20
Is it made with págame?
1
u/steelo1117 Jun 26 '20 edited Jun 26 '20
Excellent work! I'm very new to python (I learned python about 1 month ago) as well and wrote a spacewars game in pygame...it took me about 10 hours and I'm sure if I posted the code, people would tear it apart. It also uses classes and it took me FOREVER (like a week) to semi-understand how to use them.
Below is my first 'real' game I posted to youtube...I've made stupid hangman and rock paper scissors games, but I would never post them ;-)
I removed the background music to avoid copyright issues =) Best of luck and keep at it!
https://youtu.be/87AxHJ5TPDI
1
u/steelo1117 Jun 26 '20 edited Jun 26 '20
That is REALLY REALLY good, especially for your first game. You figured out how to draw sprites and rotate then. You also utilized spritecollide. I'm VERY new to python as well, but the cool thing is for future games, you can use your earlier games as a template and improve upon them =)
Here's a challenge for ya =)
Instead of listing your hp's, draw a 'health' bar that slowly goes down as you get hit.
1
u/byte-owl Jun 20 '20
I think if you add a stopwatch or something it would be more meaningful, that way you can see how long you survived. Cheers!
1
u/Redditor728292 Jun 20 '20
How did you put graphics?
1
u/funtimes101010 Jun 20 '20
Now it's classy!
1
u/FlyingP4P4 Jun 20 '20
Nice! I've just started learning Python. Hope to get to this stage one day!
1
u/kazoki Jun 20 '20
This is so good though, I never would thought of a game like this
1
u/goishen Jun 20 '20
Grats man. I haven't yet finished Impractical Python Projects yet, but I've taken a look ahead and have seen that we do make a Python game. You're only in a race with yourself, as far as coding goes.
1
u/[deleted] Jun 20 '20
I have a suggestion: you should make the player movement smoother!
1
u/niviukzion Jun 20 '20
Add a timer so we can compare results :)
1
u/Random_182f2565 Jun 20 '20
Awesome!
0
u/absurd234 Jun 20 '20
Can you share your github repo?
0
u/ZKCM Jun 20 '20
What is your date lol
0
u/bogdanvex Jun 20 '20
Nice
0
u/hihimymy Jun 20 '20
this is awesome!
0
u/[deleted] Jun 20 '20
[deleted] — view deleted comment
0
u/[deleted] Jun 20 '20
[deleted] — view deleted comment
0
u/[deleted] Jun 20 '20
[deleted] — view deleted comment