Thursday Python 18:30
Home > Thursday Python 18:30 (Page 2)
Question:
Continue modify the program we made in the class:
create Energy class. A new energy crystal object will be created when the enemy spaceship explode
use spritecollide to let the fighter collect energy crystals, if the energy crystal is collected, the score will increase
...
Question:
Modify the program we made in the class. Add starting screen as below, the real game will start when play click the mouse in the range of the “PLAY” button. (Scroll down for more hint)
You can choose and download one of the background images base...
Question:
Make changes of the program we made in the class, so the enemy spaceship could complete the following tasks:
the new enemies will appear at the random x position from the top of the screen.
the enemy can bounce back when it reaches left...
Question:
Please refer to Pirateship class to create a class Enemy:
Create one enemy on the screen
The enemy will appear at the top of the screen when we start the game
The enemy could bounce left-right
The enemy will keep move down until to the...
Question:
We have learned how to make the pirate ship bouncing left and right, try the following:
How to make the pirate ship move and bounce diagonally when it reaches the edge ( the pirate ship image is 200px by 166px)
...
Question 1:
Draw the following picture in the pygame window: (could be different color)
Hint: using pygame.draw.circle
Question 2:
Draw below image using pygame. (could using different color)
...
Question:
Create a Python class Person with attributes: name and age of type string.
Create a display() method that displays the name and age of an object created via the Person class.
Create a child class Student which inherits from the Person class and which also has a section attribute.
Create a method displayStudent() that...
Question 1:
Create a Student class and make the following methods to :
__init__() – Initialize it with name and roll number.
__str__() – Display all information of the student.
setAge() – It should assign age to student.
setMarks() – It should assign marks to the...
Question:
Create a Tank class which have the attributes of:
model
direction(use ‘up’, ‘down’, ‘left’ or ‘right’)
x position and
y position
The class also have the following method:
move () method can change the x or y position by 10 base on the tank’s direction. (‘up’ and...
Question:
Make a class definition for a BankAccount. It should have attributes for :
– its name (a string),
– account number (a string or integer),
– and balance (a float).
It should have methods to:
– make deposits with displaying the balance,
– and make withdrawals with displaying the balance.
Hint:
...