Game Development Reference
In-Depth Information
public void
move(){
this
.
y
-= 6;
//move upward
tick
++;
}
}
//3 drawing methods in GameView class.
public void
drawScore(Canvas canvas,
int
score,
int
imgid,
int
x,
int
y){
if
(score>0) drawNumber(canvas,score,x,y);
//displays “Good Job” on the screen
if
(imgid>0) BitmapManager.drawSystemPublic(imgid,canvas,x-40,y+40);
}
public void
drawNumber(Canvas canvas,
int
score,
int
x,
int
y) {
String sScore = score+
""
;
int
length = sScore.length();
for
(
int
i=0;i<length;i++){
//displays points on the screen
BitmapManager.drawNumberPublic(sScore.charAt(i)-
'0'
,canvas,
x+NUMBER_SPAN*i, y);
}
}
public void
drawNumber(Canvas canvas,
int
score,
int
x,
int
y,
int
flag) {
String sScore = score+
""
;
int
length = sScore.length();
for
(
int
i=0;i<length;i++){
//displays points on the screen
BitmapManager.drawNumberPublic(sScore.charAt(i)-
'0'
,canvas,
x+(
int
)(0.7*NUMBER_SPAN)*i, y, 0);
}
}
Getting Rewards
Whenever the player picks up any bonus on the map, he/she is rewarded with points to add
to his/her score.
Search WWH ::
Custom Search