The anatomy of a 2D Python game as seen through pictures and videos…

Let's have a look at the steps needed to create this game: thepythoncodingbook.com/2022/04/24/pyt…

👇🪡🧵

#python #100daysofcode #coding #2DGame

1 of 12
1. Create the window and game background

2 of 12
2. Create the lunar module

3 of 12
3. Set the lunar module to start rotating when you press a key…

…but once it starts, it keeps spinning faster and faster and faster…

4 of 12
4. Add option to stop accelerating the rotation when key is released

5 of 12
5. Add some artistic flare—show the fuel burning from the thrusters when they're turned on.

6 of 12
6. Lunar module needs to translate as well as rotate…

7 of 12
7. The thrusters are not just for rotation. When both are on, the lunar module moves forward…

8 of 12
8. And then, there's gravity to pull the lunar module downwards, towards the lunar surface.

9 of 12
9. Finally, there's a landing pad for the lunar module to land on…

…as long as the position and orientation is within landing tolerances!

10 of 12
Read the step-by-step tutorial on The Python Coding Book blog: thepythoncodingbook.com/2022/04/24/pyt…

11 of 12
I hope you liked this anatomy of a 2D game thread…

Follow me @s_gruppetta_ct for more.

Like/Retweet the first tweet below if you can:

#python #coding

12 of 12

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Stephen Gruppetta

Stephen Gruppetta Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @s_gruppetta_ct

Apr 27
itertools.takewhile()

one of those good-to-know-about-functions

I decided to explore it today…

Read on if you've not come across takewhile before…

👇🪡🧵

#Python #coding #100daysofcode

1/7 Image
takewhile takes successive items from a sequence for as long as a certain condition is true.

It's the equivalent of using a _while_ loop to _take_ successive items from the sequence until the while condition is not met–hence the name takewhile.

2/7
In this example, the challenge is to see how many successive heads I can get when I flip a coin…

3/7 Image
Read 7 tweets
Apr 26
When I trained as a scientist, #programming was a required tool in some select areas of #physics & #maths but not much beyond that…

That's no longer the case. #Coding is rapidly becoming a must-have skill in all scientific fields

Read on…

👇🪡🧵

#ScientificComputing

1/4
In recent years, I have introduced #Python #coding to chemists, biologists, psychologists, medical scientists, geologists, well, the list goes on.

Suffice to say that it spans all areas of science.

Why?

2/4
All of these teams and individuals realise that either they have large amounts of data they need to analyse in all sorts of different ways, or they need to simulate experiments and create computational models.

#Python is often the language of choice in many of these fields.

3/4
Read 4 tweets
Apr 25
Happy Birthday 🎂 ThePythonCodingBook.com
You're turning 1 🕯️ in a few days' time.

I'm still shocked how almost 20,000 people visit every month just from organic traffic.

A number of posts have done extremely well.

Here are the top five:

#python #coding #100daysofcode

1/8
In #5th place:

The White Room analogy that explains a lot of what's happening in #programming using a mental image that everyone can relate to.

thepythoncodingbook.com/understanding-…

#python #100daysofcode

2/8
In #4th place:

This fun project designed to practise using lists, tuples, dictionaries, and sets in a fun turtle-based animation.

thepythoncodingbook.com/2021/10/31/usi…

#python #turtle #datastructures

3/8
Read 8 tweets
Apr 19
"I'm struggling to understand <topic>.
No matter how much I try, I can't get it"

As I've been getting to know the #Pythonverse on Twitter better in recent weeks, I've seen this common theme recur often from beginners

If this is you, read on…
👇🪡🧵

#Python #codenewbie #coding
It's not just you.

This is the norm, not the exception

There are a number of reasons why this happens.

Here are some of them…
〰️
You may be learning a topic a bit too early.

Some topics need a good understanding of other concepts before you can fully grasp them.

#ObjectOrientedProgramming is one such area. Many beginners try to learn this topic before they've fully mastered the basics…
Read 8 tweets
Apr 18
There are many ways to practise using different data structures in #Python

…not many are as fun as this one!

Here's the step-by-step tutorial to work your way towards writing this animation: thepythoncodingbook.com/2021/10/31/usi…

#100daysofcode #coding #learnPython

1 of 3
In this project, you'll get to use lists, tuples, dictionaries, and sets to set up the grid, colours, and get the balls to bounce and speed across the tiles.

It's fun to write, and fun to watch, too!

2 of 3
If you don't have the time for this but know someone who does, please do share…

#python #coding

3 of 3
Read 4 tweets
Apr 17
thereisareasonwhyweusespacesandpunctuation

Languages like Latin and Ancient Greek didn't always have spaces and punctuation.

Code wasn't always written to be readable.

Both things have changed, for the better

readon👇🪡🧵

thepythoncodingbook.com/2021/10/11/pyt…
#python #100daysofcode #pep8
In the earlier days of computer #programming, there were only a few programmers.

The complexity of computer code was limited primarily by the hardware restrictions on memory and speed of execution.

#codinginthepast #coding
Code was rarely shared and read by others, and teams working on software were small and often consisted of just one person.
Read 18 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(