-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobj
67 lines (51 loc) · 1.16 KB
/
obj
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* obj.java
*
* © <your company here>, 2003-2007
* Confidential and proprietary.
*/
package com.synthdreams.BBTest1;
import net.rim.device.api.system.Bitmap;
class OBJ
{
int posX, posY, velX, velY;
Bitmap bitmap;
OBJ(int passX, int passY)
{
posX = passX;
posY = passY;
velX = 0;
velY = 0;
}
public int getX() { return posX; }
public int getY() { return posY; }
public void setX(int passX) { posX = passX; }
public void setY(int passY) { posY = passY; }
public Bitmap getBitmap() { return bitmap; }
public void process()
{
// No default actions for an object
}
}
public class EnemyDrone extends OBJ
{
EnemyDrone(int passX, int passY)
{
super(passX, passY);
bitmap = Bitmap.getBitmapResource("spaceship.png");
velY = 1;
}
public void process()
{
posX += velX;
posY += velY;
if (posX < 10)
velX = 1;
if (posX > 100)
velX = -1;
if (posY < 10)
velY = 1;
if (posY > 100)
velY = -1;
}
}