android - Changing object speed -
i have been creating simple game fun, , have ran troubles.
setting new speed on object falling down. score rises user, woudl want change speed , increase little little. happens current speed adds speed want increase because more faster.
this activity:
public void starttimer() { timer = new timer(); initializetimertask(); timer.schedule(timertask, 100, 20); } public void stoptimertask() { if (timer != null) { timer.cancel(); timer = null; } } public void initializetimertask() { timertask = new timertask() { public void run() { handler.post(new runnable() { public void run() { godown(); } }); } }; } public void godown() { frame = (framelayout) findviewbyid(r.id.frame); frameheight = frame.getheight(); boxy = (int) txtword.gety(); boxsizey = txtword.getheight(); if(scorecount >= 0) { boxy += 1; } if(scorecount >= 5) { boxy += 2; } if(scorecount >= 10) { boxy += 3; } txtword.sety(boxy); if (boxy > frameheight - boxsizey) { boxy = frameheight - boxsizey; stoptimertask(); displaygameover(); } }
thanks in advance insight or help! :d
if(scorecount >= 0 && scorecount < 5) { boxy += 1; } if(scorecount >= 5 && scorecount < 10) { boxy += 2; } if(scorecount >= 10) { boxy += 3; }
try speed issue.
Comments
Post a Comment