this is not the complete assignment , please see file attached , charters was over the limit and had cut lots of lines from the bottom. [login to view URL] file attached have the complete description.
#I - Import and initalise
import pygame
from assignment7objects import *
[login to view URL]()
# Assignment #8: Get to the castle!
# Another game only half complete!
# We need you to animate your player so they can get to the castle! To do so, you will need
# to load up all the graphics for the player and write the code to make them animate.
# You will need to use CONSTANTS as easy-to-read labels throughout your code, and also as
# Indexes for the super-list of graphics you will create. The good news is the constants
# are already created for you, you'll just have to use them in your code later on
# =======================================
# =======================================
# === Constants
# These are used to provide human-readable labels throughout your code. It's far easier to understand
# "[login to view URL][WEST]" would give you a list of all the WESTERN images than "[login to view URL][1]"
EAST = 0
WEST = 1
NORTH = 2
SOUTH = 3
STANDING = 4
WALKING = 5
class Player([login to view URL]):
def __init__(self, position):
pygame.sprite.Sprite.__init__(self)
# First thing we do is load all the images into the class
[login to view URL]()
# now lets declare the variables we will be using. Just like the examples from the book,
# We have a FRAME, which states which frame of our animation we're displaying;
# We have a DELAY, which tells us how many clock ticks to wait before showing the next frame;
# We have a PAUSE, which is the counter for the delay
# and we have our delta-x and delta-y, which describe our change in position every tick.
[login to view URL] = 0
[login to view URL] = 4
[login to view URL] = [login to view URL]
[login to view URL] = 0
[login to view URL] = 0
# And finally, we also have our STATE, which describes what animation we should be doing;
# And we have a DIRECTION, which describes which direction the player is facing.
# Note how the state and direction are using the constants declared above.
[login to view URL] = STANDING
[login to view URL] = EAST
# this is to just give us a starting image and rect, as required for any sprite
[login to view URL] = [login to view URL]("char1/[login to view URL]").convert()
colorkey = self.image.get_at((0,0))
self.image.set_colorkey(colorkey)
[login to view URL] = self.image.get_rect()
[login to view URL] = position
def loadPics(self):
# if you want a different character, change the foldername to char2/, char3/, or whichever you prefer
fileBase = ["char1/east", "char1/west", "char1/north", "char1/south"]
[login to view URL] =[ ]
# STEP 1: Load all the animation images
# We have a "List of Lists" up above called self.images. each sub-list will contain all
# the images for that specific direction. What you'll want to do is make sure the indexes for
# all the lists you add correspond to the Constants declared above. I.E. [login to view URL][0] is for
# the EAST direction. That way, later on in the program, when we want the current frame for a
# specific direction, say SOUTH, we can just call:
# [login to view URL] = [login to view URL][SOUTH][[login to view URL]]
# Anyway, for now, your task is to load all the images into those lists using for loops.
Hi armanian.
I can do this assigent, but I'm little busy next couple of days, so if your deadline is before Wednesday, I'm not sure I can deliver.
Best regards,
Fejs.
I have this completed for you. The character now animates by pressing the arrow keys by following the directions in the assignment. Accept my bid and I can give it to you immediately :) My name is Will and I live on the west coast of the US, so both communication and time zones should work in our favor.