Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Chaowen Zeng- SWEN20003
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chaowen Zeng
Chaowen Zeng- SWEN20003
Commits
823ae066
Commit
823ae066
authored
4 years ago
by
Chaowen Zeng
Browse files
Options
Downloads
Patches
Plain Diff
Update src/Player.java, src/Sandwich.java, src/Zombie.java files
parent
b03d5e42
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/Player.java
+35
-0
35 additions, 0 deletions
src/Player.java
src/Sandwich.java
+30
-0
30 additions, 0 deletions
src/Sandwich.java
src/Zombie.java
+30
-0
30 additions, 0 deletions
src/Zombie.java
with
95 additions
and
0 deletions
src/Player.java
0 → 100644
+
35
−
0
View file @
823ae066
import
bagel.Image
;
import
bagel.util.Point
;
/**
* a movable entity: player
*/
public
class
Player
{
/**
* the player's image displayed in the window
*/
private
final
Image
image
;
/**
* render position of the player in the window
*/
private
Point
pos
;
/**
* Player's current energy value
*/
private
int
energy
;
/**
* constructor
* @param x abscissa
* @param y ordinate
*/
public
Player
(
double
x
,
double
y
,
int
energy
)
{
this
.
image
=
new
Image
(
"res/images/player.png"
);
this
.
pos
=
new
Point
(
x
,
y
);
this
.
energy
=
energy
;
}
/**
* draw player on the background
*/
public
void
draw
()
{
image
.
drawFromTopLeft
(
pos
.
x
,
pos
.
y
);
}
}
This diff is collapsed.
Click to expand it.
src/Sandwich.java
0 → 100644
+
30
−
0
View file @
823ae066
import
bagel.Image
;
import
bagel.util.Point
;
/**
* a stationary entity: sandwich
*/
public
class
Sandwich
{
/**
* the sandwich's image displayed in the window
*/
private
Image
image
;
/**
* a Point object representing the position of the sandwich
*/
private
Point
pos
;
/**
* constructor
* @param x abscissa
* @param y ordinate
*/
public
Sandwich
(
double
x
,
double
y
){
this
.
image
=
new
Image
(
"res/images/sandwich.png"
);
this
.
pos
=
new
Point
(
x
,
y
);
}
/**
* draw sandwich on the background
*/
public
void
draw
()
{
image
.
drawFromTopLeft
(
pos
.
x
,
pos
.
y
);
}
}
This diff is collapsed.
Click to expand it.
src/Zombie.java
0 → 100644
+
30
−
0
View file @
823ae066
import
bagel.Image
;
import
bagel.util.Point
;
/**
* a stationary entity: zombie
*/
public
class
Zombie
{
/**
* the zombie's image displayed in the window
*/
private
Image
image
;
/**
* a Point object representing the position of the zombie
*/
private
Point
pos
;
/**
* constructor
* @param x abscissa
* @param y ordinate
*/
public
Zombie
(
double
x
,
double
y
){
this
.
image
=
new
Image
(
"res/images/zombie.png"
);
this
.
pos
=
new
Point
(
x
,
y
);
}
/**
* draw zombie on the background
*/
public
void
draw
()
{
image
.
drawFromTopLeft
(
pos
.
x
,
pos
.
y
);
}
}
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