Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TDIU20
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cpp-programmering
TDIU20
Commits
8a4940fb
Commit
8a4940fb
authored
1 year ago
by
Alrik Appelfeldt
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
c91bdf67
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Uppgift-3-Spel/ghost.h
+82
-0
82 additions, 0 deletions
Uppgift-3-Spel/ghost.h
with
82 additions
and
0 deletions
Uppgift-3-Spel/ghost.h
0 → 100644
+
82
−
0
View file @
8a4940fb
#ifndef GHOST_H
#define GHOST_H
#include
"given.h"
//#include "given.h"
#include
"string"
using
namespace
std
;
class
Ghost
{
public:
Ghost
(
std
::
string
const
&
color
,
Point
const
&
start_pos
);
virtual
void
set_pos
(
Point
&
new_pos
);
virtual
Point
get_scatter
(
const
Point
&
pos_pacman
)
=
0
;
virtual
Point
get_chase
(
const
Point
&
pos_pacman
,
const
Point
&
dir_pacman
)
=
0
;
virtual
Point
get_pos
();
virtual
std
::
string
get_color
()
const
=
0
;
virtual
~
Ghost
()
=
default
;
public:
std
::
string
color_index
;
Point
pos
;
};
class
Clyde
:
public
Ghost
{
public:
Clyde
(
std
::
string
const
&
color
,
Point
const
&
start_pos
);
void
set_pos
(
Point
&
new_pos
);
Point
get_scatter
(
const
Point
&
pos_pacman
);
Point
get_chase
(
const
Point
&
pos_pacman
,
const
Point
&
dir_pacman
);
Point
get_pos
();
std
::
string
get_color
()
const
;
};
class
Pinky
:
public
Ghost
{
public:
Pinky
(
std
::
string
const
&
color
,
Point
const
&
start_pos
);
void
set_pos
(
Point
&
new_pos
);
Point
get_scatter
(
const
Point
&
pos_pacman
);
Point
get_chase
(
const
Point
&
pos_pacman
,
const
Point
&
dir_pacman
);
Point
get_pos
();
std
::
string
get_color
()
const
;
};
class
Blinky
:
public
Ghost
{
public:
bool
get_angry
();
void
set_angry
(
bool
state
);
Blinky
(
std
::
string
const
&
color
,
Point
const
&
start_pos
);
void
set_pos
(
Point
&
new_pos
);
Point
get_scatter
(
const
Point
&
pos_pacman
);
Point
get_chase
(
const
Point
&
pos_pacman
,
const
Point
&
dir_pacman
);
Point
get_pos
();
std
::
string
get_color
()
const
;
private:
bool
angry
=
false
;
};
#endif
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment