2016年9月2日星期五

Week 6 CRC Card & Project Progress

This week lecture was looking more at coding aspect, and show us one technique for identify your concept class which is class responsibility and collaboration cards. Each card presents an individual class and include its responsibilities and its collaborators.

Pacman

Responsibilities:
Move-up
Move-down
Move-left
Move-right
Eat Pac-dots

Collaborators:
Pac-dot
Wall

In Class Card

Pac-dot

Responsibilities:
Eaten by Pacman

Collaborators:
Pacman

In Class Card

Wall

Responsibilities:
Detect Pacman
Hit by Pacman

Collaborators:
Pacman


In Class Card


Score

Responsibilities:
Detect Pac-dots
Add score

Collaborators:
Pacman

Pac-dots
In Class Card


This week's progress:
I create a new function that can destroy objects,so it's allow me to make the Pac-dots disappear when Pacman touch them. i attach this script to the Pac-man object, so Pacman can eat Pac-dots now.



another new function is about scores, this script give each player a initial score (playerscore=0) and add scores, then call this function when Pacman eat dots. next week i will focus on the UI part,which is display scores and instructions on the screen.




没有评论:

发表评论