You've already forked lazarus-ccr
iphonelazext: improved iArkanoid sample graphics and performance
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1142 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -253,16 +253,8 @@ begin
|
||||
end;
|
||||
|
||||
if (cy >= PaddleY-5) and (cx >= PaddleX) and (cx <= PaddleX + PaddleW) and (dy>0) then begin
|
||||
t := (cx - PaddleX - PaddleW/2) / (PaddleW/2);
|
||||
|
||||
if t > 1 then t := 1
|
||||
else if t < -1 then t:=-1;
|
||||
|
||||
|
||||
if t < 0 then
|
||||
t := pi/2 + pi/16 - t / 2
|
||||
else
|
||||
t := pi/2 - pi/16 - t / 2;
|
||||
t := (cx - PaddleX) / PaddleW;
|
||||
t:=pi*(1-(t*0.8+0.1));
|
||||
dx := cos(t)*ballVelocity;
|
||||
dy := -sin(t)*ballVelocity;
|
||||
cy := PaddleY-5;
|
||||
@ -290,10 +282,8 @@ begin
|
||||
with Balls[i] do begin
|
||||
x := PaddleX+PaddleW/2;
|
||||
y := PaddleY-5;
|
||||
//a := random*pi/4 + (pi/2 - pi/8);
|
||||
//if cos(a)*5 < 0.1 then a := a + pi/5;
|
||||
//a:=5*pi/4;
|
||||
a:=3*pi/2;
|
||||
a := random*pi/4 + (pi/2 - pi/8);
|
||||
if cos(a)*5 < 0.1 then a := a + pi/5;
|
||||
dx := ballVelocity*cos(a);
|
||||
dy := ballVelocity*sin(a);
|
||||
sticked:=true;
|
||||
|
@ -91,12 +91,8 @@ begin
|
||||
CGContextFillRect(ctx, r);
|
||||
|
||||
for i := 0 to game.brickCount - 1 do begin
|
||||
if game.bricks[i].flash > 0 then begin
|
||||
MakeCGRect(game.bricks[i].bounds, r);
|
||||
CGContextSetRGBFillColor(ctx, 1, 1, 1, 1);
|
||||
CGContextFillRect(ctx, r);
|
||||
dec(game.bricks[i].flash);
|
||||
end else if game.bricks[i].health > 0 then begin
|
||||
MakeCGRect(game.bricks[i].bounds, r);
|
||||
if game.bricks[i].health > 0 then begin
|
||||
MakeCGRect(game.bricks[i].bounds, r);
|
||||
CGContextSetRGBFillColor(ctx, 1, 0, 0, 1);
|
||||
CGContextFillRect(ctx, r);
|
||||
@ -107,6 +103,11 @@ begin
|
||||
CGContextSetRGBFillColor(ctx, 0.8, 0, 0, 1);
|
||||
CGContextFillRect(ctx, r);
|
||||
end;
|
||||
if game.bricks[i].flash > 0 then begin
|
||||
CGContextSetRGBFillColor(ctx, 1, 1, 1, 1/(game.bricks[i].flash+1));
|
||||
CGContextFillRect(ctx, r);
|
||||
dec(game.bricks[i].flash);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -124,7 +125,7 @@ procedure MyMainWindow.initObjects;
|
||||
begin
|
||||
{ create timer }
|
||||
timer := NSTimer.scheduledTimerWithTimeInterval_target_selector_userInfo_repeats(
|
||||
double(0.1), Self, objcselector(timerEvent_), nil, true);
|
||||
double(0.075), Self, objcselector(timerEvent_), nil, true);
|
||||
game := TArkanoid.Create(300, 400);
|
||||
game.Init;
|
||||
end;
|
||||
|
Reference in New Issue
Block a user