Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help so please experts!!!!! Thank you...... ALIENS HAVE LANDED!!!!! Lets not lose our heads. Download and investigate the python script Alien Blaster. Take those

Need help so please experts!!!!! Thank you......

ALIENS HAVE LANDED!!!!! Lets not lose our heads. Download and investigate the python script Alien Blaster. Take those concepts to create the Alien Wars Game. The war has come down to two enemies, our hero, Arnold, battling the alien, Zxblrb. Create two classes, one for each player, and all the attributes and methods are public. The game loop should randomly select who shoots next. The game is over when one is dead:

Class Hero

Attributes

name, set so it defaults to Arnold, but can be reset to some other name.

health, initialized to 10

shield, initialized to 10, but is not used in this game.

life, initialized to 1

Methods:

Constructor, init (), takes a string parameter that defaults to Arnold.

blast(), takes an player object argument to communicate that the enemy has been hit. Blast() implements an immediate call to the enemy die() method.

die(), no arguments, decrements health. Decrements lives, when health gets to 0. When lives is 0, the soldier dies.

Class Alien

Same as Hero

Main()

Game over when one combatant is dead.

# Alien Blaster

# Demonstrates object interaction

class Player(object):

""" A player in a shooter game. """

def blast(self, enemy):

print("The player blasts an enemy. ")

enemy.die()

class Alien(object):

""" An alien in a shooter game. """

def die(self):

print("The alien gasps and says, 'Oh, this is it. This is the big one. " \

"Yes, it's getting dark now. Tell my 1.6 million larvae that I loved them... " \

"Good-bye, cruel universe.'")

def main():

print("\t\tDeath of an Alien ")

hero = Player()

invader = Alien()

hero.blast(invader)

# main

main()

input(" Press the enter key to exit.")

use this code as guide

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions

Question

What is electric dipole explain with example

Answered: 1 week ago