- 20th Jul 2024
- 20:02 pm
In this assignment, you will create a simple game by following a YouTube master class. Additionally, you should utilize the characters from this game, and if needed, you can incorporate elements from another game available in your database.
Learning objectives:
- To reinforce critical thinking and reflection while discussing the role of creativity
- To use checklists as a guide for the writing process
- To practice writing Report Discussions and Abstracts
- To provide effective and useful peer feedback
Exercise 1
You listened to a TED Talk about the role of creativity in education and got familiar with a source
discussing the role of creativity in Engineering by Belski (2017). Discuss in groups of 3-4:
1. How creativity can be defined and measured?
2. How should creativity be taught?
3. What exactly is Engineering creativity?
Exercise 2
Having a checklist on hand to refer to before you submit your final written assignments can be incredibly helpful. You should be able to refer to this checklist before, during and after you have written your assignment. Try creating an outline (structure) checklist for the Report Discussion and Abstract. What features/sections do you need?
Free Assignment Solution - Developing An Online Game Using Python
import pygame, sys, math, random as rand
pygame.init()
screen = pygame.display.set_mode((500,600))
pygame.display.set_caption("Py-Rate Adventures")
clock = pygame.time.Clock()
#initializing
l = pygame.image.load("land_tile.png").convert_alpha(screen)
l = pygame.transform.smoothscale(l,(100,100))
o = pygame.image.load("ocean_tile.png").convert_alpha(screen)
o = pygame.transform.smoothscale(o,(100,100))
large_font = pygame.font.SysFont("Calibri",100)
small_font = pygame.font.SysFont("Calibri", 30)
start_button = pygame.image.load("start_button.png").convert_alpha(screen)
start_rect = start_button.get_rect()
restart_button = pygame.image.load("restart_button.png").convert_alpha(screen)
restart_button = pygame.transform.smoothscale(restart_button,(300,100))
restart_rect = restart_button.get_rect()
explosion = pygame.image.load("explosion_image.png").convert_alpha(screen)
scroll = [0,500]
screen_speed = 1
h_size = 210
score = 0
game_map = [
[o,o,o,o,o],
[o,o,o,o,o],
[o,o,o,o,o],
[o,o,o,o,o],
[o,o,o,o,o],
[l,l,l,l,l],
]
def start_screen():
start_map = [
[l,l,l,l,l],
[l,o,o,o,l],
[l,o,o,o,l],
[l,o,o,o,l],
[l,o,o,o,l],
[l,l,l,l,l],
]
map_x = 0
map_y = 0
for i in start_map:
for a in i:
if a == o:
screen.blit(o,(map_x,map_y))
map_x += 100
else:
screen.blit(l,(map_x,map_y))
map_x += 100
map_x = 0
map_y += 100
title_surface = large_font.render("PyRate",False,(0,0,0))
screen.blit(title_surface,(113,193))
screen.blit(start_button,(176,320))
start_rect.topleft = (176,320)
start_surface = small_font.render("START",False,(0,0,0))
screen.blit(start_surface,(210,342))
def game_screen():
global screen_speed, score
game_map.reverse()
map_x = scroll[0]
map_y = scroll[1]
for i in game_map:
for a in i:
if a == o:
screen.blit(o,(map_x,map_y))
map_x += 100
else:
screen.blit(l,(map_x,map_y))
map_x += 100
map_x = 0
map_y -= 100
scroll[1] += screen_speed
screen_speed += 0.001
o_list = [o,o,o,o,o]
game_map.insert(0,o_list)
score_surface = small_font.render("SCORE : "+str(score),False,(255,255,255))
screen.blit(score_surface,(315,14))
def healthbar():
global h_size, z
pygame.draw.rect(screen,"red",pygame.Rect(10,10,h_size,26.75))
pygame.draw.rect(screen,"white",pygame.Rect(10,10,200,29),4)
if player.rect.colliderect(enemy_1.enemy_rect):
screen.blit(explosion,(enemy_1.rand_x,enemy_1.y))
enemy_1.y = -20
enemy_1.rand_x = rand.randrange(10,450,50)
h_size -= 15
pygame.time.delay(50)
elif player.rect.colliderect(enemy_2.enemy_rect):
screen.blit(explosion,(enemy_2.rand_x,enemy_2.y))
enemy_2.y = -20
enemy_2.rand_x = rand.randrange(10,450,50)
h_size -= 15
pygame.time.delay(50)
elif player.rect.colliderect(enemy_3.enemy_rect):
screen.blit(explosion,(enemy_3.rand_x,enemy_3.y))
enemy_3.y = -20
enemy_3.rand_x = rand.randrange(10,450,50)
h_size -= 15
pygame.time.delay(50)
if h_size <= 0:
z = 2
def end_screen():
global z
screen.fill("white")
end_surface = large_font.render("GAME OVER",False,(0,0,0))
screen.blit(end_surface,(0,150))
end_score_surface = small_font.render("SCORE : "+str(score),False,(0,0,0))
screen.blit(end_score_surface,(180,320))
screen.blit(restart_button,(100,400))
restart_rect.topleft = (100,400)
class Player(pygame.sprite.Sprite):
def __init__(self):
super().__init__()
self.image = pygame.image.load("player_ship.png").convert_alpha()
self.rect = self.image.get_rect()
self.player_speed = 1
self.x = 217
self.y = 300
def draw(self,screen):
screen.blit(self.image, (self.x,self.y))
self.rect.topleft = (self.x,self.y)
self.player_speed += 0.0001
def movement(self):
keys = pygame.key.get_pressed()
if keys[pygame.K_UP] and self.y > 0:
self.y -= self.player_speed
self.rect.y -= self.player_speed
if keys[pygame.K_DOWN] and self.y < 490:
self.y += self.player_speed
self.rect.y += self.player_speed
if keys[pygame.K_RIGHT] and self.x<433:
self.x += self.player_speed
self.rect.x += self.player_speed
if keys[pygame.K_LEFT] and self.x>0:
self.x -= self.player_speed
self.rect.x -= self.player_speed
class Enemy(pygame.sprite.Sprite):
def __init__(self):
super().__init__()
self.image = pygame.image.load("enemy_ship.png").convert_alpha(screen)
self.rotated_e = pygame.transform.rotate(self.image,180)
self.enemy_rect = self.rotated_e.get_rect()
self.rand_x = rand.randrange(10,450,50)
self.y = 0
self.enemy_speed = rand.randrange(2,4)
def draw(self,screen):
screen.blit(self.rotated_e,(self.rand_x,self.y))
self.enemy_rect.topleft = (self.rand_x,self.y)
self.y += self.enemy_speed
self.enemy_speed += 0.001
if self.y > 600:
self.y = -20
self.rand_x = rand.randrange(10,450,50)
z = 0
t = 0
player = Player()
enemy_1 = Enemy()
enemy_2 = Enemy()
enemy_3 = Enemy()
e_l = [enemy_1,enemy_2,enemy_3]
all_sprites = pygame.sprite.Group()
all_sprites.add(player)
for i in e_l:
all_sprites.add(i)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
if event.type == pygame.MOUSEBUTTONDOWN:
pos = pygame.mouse.get_pos()
if start_rect.collidepoint(pos):
z = 1
if restart_rect.collidepoint(pos):
z = 1
t = 0
h_size = 200
screen_speed = 1
score = 0
player.x = 217
player.y = 300
for i in e_l:
i.y = -20
i.enemy_speed = rand.randrange(2,4)
all_sprites.update()
if z == 0:
start_screen()
elif z == 1:
game_screen()
healthbar()
player.draw(screen)
player.movement()
if t < 400:
enemy_1.draw(screen)
elif 400 <= t < 1500:
enemy_1.draw(screen)
enemy_2.draw(screen)
else:
enemy_1.draw(screen)
enemy_2.draw(screen)
enemy_3.draw(screen)
score += 1
t += 1
else:
end_screen()
pygame.display.update()
clock.tick(60)
Get the best Developing An Online Game Using Python assignment help and tutoring services from our experts now!
Please note that this is a sample assignment solved by our Python Programmers. These solutions are intended to be used for research and reference purposes only. If you can learn any concepts by going through the reports and code, then our Python Tutors would be very happy.
- Option 1 - To download the complete solution along with Code, Report and screenshots - Please visit our Python Assignment Sample Solution page
- Option 2 - Reach out to our Python Tutors to get online tutoring related to this assignment and get your doubts cleared
- Option 3 - You can check the partial solution for this assignment in this blog above.
About The Author - Jordan Lee
Jordan Lee is an experienced educator and writer with a focus on enhancing critical thinking and creativity in academic settings. With a deep understanding of the educational process, Jordan is dedicated to developing effective teaching strategies that foster creativity and critical reflection among students. In this assignment, Jordan explores the role of creativity in education, particularly in engineering, and emphasizes the importance of structured writing practices.