-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSprite.java
More file actions
33 lines (30 loc) · 1.21 KB
/
Sprite.java
File metadata and controls
33 lines (30 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//----------------------------------------------------------------------
// Author: Micheal Oyenekan
// Date : 10/23/2020 (Completed)
// File : Sprite.java
// Description: The Sprite class facilitates the implementation of the
// Mario and Tube classes. Since both of them require coordinates and
// dimensions, this class declares the variables for them. The classes
// on the other hand, extend the Sprite class. This prevents redundant
// declaration of the same variables. It also holds a method that loads
// images.
//-----------------------------------------------------------------------
// NOTE: The information in tubetest.json is still in the file, so when
// the program is run, a print statement appears saying "You've loaded
// a tube at (300, 306)".
//-----------------------------------------------------------------------
import java.awt.image.BufferedImage;
import java.io.File;
import java.awt.Graphics;
import javax.imageio.ImageIO;
abstract class Sprite
{
int x, y, w, h;
//String type;
abstract void update();
abstract void draw(Graphics g);
boolean isTube() { return false; }
boolean isMario() { return false; }
boolean isGoomba() { return false; }
boolean isFireball() { return false; }
}