Question
Using Python, create an actor model/module, including a control_actors_action.py file for the game Batter aka Brick Breaker: Here's what I have so far: from game
Using Python, create an actor model/module, including a control_actors_action.py file for the game "Batter" aka "Brick Breaker":
Here's what I have so far:
from game import constants
from game.point import Point
class Actor:
"""A visible, moveable thing that participates in the game. The
responsibility of Actor is to keep track of its appearance, position
and velocity in 2d space.
Stereotype:
Information Holder
Attributes:
_text (string): The textual representation of the actor.
_position (Point): The actor's position in 2d space.
_velocity (Point): The actor's speed and direction.
"""
def __init__(self):
"""The class constructor.
Args:
self (Actor): an instance of Actor.
"""
self._text = ""
self._position = Point(0, 0)
self._velocity = Point(0, 0)
def get_position(self):
"""Gets the actor's position in 2d space.
Args:
self (Actor): an instance of Actor.
Returns:
Point: The actor's position in 2d space.
"""
return self._position
def get_text(self):
"""Gets the actor's textual representation.
Args:
self (Actor): an instance of Actor.
Returns:
string: The actor's textual representation.
"""
return self._text
def get_velocity(self):
"""Gets the actor's speed and direction.
Args:
self (Actor): an instance of Actor.
Returns:
Point: The actor's speed and direction.
"""
return self._velocity
def move_next(self):
"""Moves the actor to its next position according to its velocity. Will
wrap the position from one side of the screen to the other when it
reaches the boundary in either direction.
Args:
self (Actor): an instance of Actor.
"""
def set_position(self, position):
"""Updates the actor's position to the given one.
Args:
self (Actor): An instance of Actor.
position (Point): The given position.
"""
self._position = position
def set_text(self, text):
"""Updates the actor's text to the given value.
Args:
self (Actor): An instance of Actor.
text (string): The given value.
"""
self._text = text
def set_velocity(self, velocity):
"""Updates the actor's velocity to the given one.
Args:
self (Actor): An instance of Actor.
position (Point): The given velocity.
"""
self._velocity = velocity
Thanks in advance!
Overview Batter is a game in which the player seeks to bat the ball back towards the top of the screen to break the bricks. Miss the ball and its game over! Rules Batter is played according to the following rules. 1. The bricks are arranged in 4 rows and 70 columns at the top of the screen. 2. The bat (or paddle) is positioned near the bottom of the screen. 3. The player can move the bat left or right within the boundaries of the screen. 4. The ball moves of its own accord, bouncing off the bat, bricks and walls. 5. If the bat misses the ball the game is over. Interface *********** ***** ******************************************************* ****************** ************************************************************ ************* ************************* ************** Overview Batter is a game in which the player seeks to bat the ball back towards the top of the screen to break the bricks. Miss the ball and its game over! Rules Batter is played according to the following rules. 1. The bricks are arranged in 4 rows and 70 columns at the top of the screen. 2. The bat (or paddle) is positioned near the bottom of the screen. 3. The player can move the bat left or right within the boundaries of the screen. 4. The ball moves of its own accord, bouncing off the bat, bricks and walls. 5. If the bat misses the ball the game is over. Interface *********** ***** ******************************************************* ****************** ************************************************************ ************* ************************* **************Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started