~Hakurei Shrine~ > Rika and Nitori's Garage Experiments
pikaguy900's Box of Stuff
Naut:
You could have it so that Yukari and Ran are playing Pong against eachother, and you're just stuck in the middle trying to survive! Muahahaha!
CK Crash:
--- Quote from: Naut on May 25, 2009, 04:30:03 AM ---You could have it so that Yukari and Ran are playing Pong against eachother, and you're just stuck in the middle trying to survive! Muahahaha!
--- End quote ---
I demand you change the ball to Chen. NOW
Nimono:
--- Quote from: Naut on May 25, 2009, 04:30:03 AM ---You could have it so that Yukari and Ran are playing Pong against eachother, and you're just stuck in the middle trying to survive! Muahahaha!
--- End quote ---
A nice idea, but I'm not so sure I'd want to code in another way for the CPUs to miss the ball so it's like a real Pong match... Now, if you have an idea about how I could actually do this, though, please tell me and I'll try to put it in. IT'S NOT PONG IF YOU DON'T MISS THE BALL. Unless it's Yukari. Then she just haxes you.
Naut:
Same thing you do now. Have them both move at 3 pixels, and set the ball's speed to be slightly random, so whoever misses it will be randomly generated.
Also, I agree with the Chenball. Make it happen.
Nimono:
--- Code: ---#TouhouDanmakufu
#Title[Destroyer "Chenball"]
#Text[Chen, the only thing you're good for is being a ball in my little game, so get in there and help me crush this pest! If you don't, no food for a whole week!]
#Image[.\CheatingAtPong.bmp]
#BackGround[Default]
#PlayLevel[Lunatic]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main
{
let FocusInc = false; //Change this to true if you want focused movement to affect the speed of the ball!
let BossImage = GetCurrentScriptDirectory ~ "boss_yukari.png";
let BossCutIn = GetCurrentScriptDirectory ~ "Yukari.png";
let frame = -160;
let timer = 0;
let frame2 = -60;
let BallExist = false;
let PaddleExist = false;
let Paddle1 = NULL;
let Paddle2 = NULL;
let Ball = NULL;
let BounceCount = 0;
let Dir = [35, 125, 215, 305];
let Wait = 4;
let Settings1 = 0;
let Angle = 10;
let Speed2 = 3;
task Pong(who)
{
if(who == 0)
{
if(Obj_BeDeleted(Paddle1))
{
Paddle1 = Obj_Create(OBJ_SHOT);
Obj_SetPosition(Paddle1, GetX, 425 - 30);
Obj_SetCollisionToPlayer(Paddle1, false);
Obj_SetCollisionToObject(Paddle1, true);
Obj_SetSpeed(Paddle1, 0);
ObjShot_SetDelay(Paddle1, 10);
ObjShot_SetGraphic(Paddle1, 4);
ObjShot_SetBombResist(Paddle1, true);
Obj_SetAngle(Paddle1, 270);
Obj_SetAlpha(Paddle1, 250);
}
while(! Obj_BeDeleted(Paddle1))
{
Obj_SetPosition(Paddle1, GetX, 425 - 30);
yield;
}
}
else if(who == 1)
{
if(Obj_BeDeleted(Paddle2))
{
Paddle2 = Obj_Create(OBJ_SHOT);
Obj_SetPosition(Paddle2, GetX, GetY + 30);
Obj_SetCollisionToPlayer(Paddle2, false);
Obj_SetCollisionToObject(Paddle2, true);
Obj_SetSpeed(Paddle2, 0);
ObjShot_SetDelay(Paddle2, 10);
ObjShot_SetGraphic(Paddle2, 4);
ObjShot_SetBombResist(Paddle2, true);
Obj_SetAngle(Paddle2, 90);
Obj_SetAlpha(Paddle2, 250);
}
while(! Obj_BeDeleted(Paddle2))
{
Obj_SetPosition(Paddle2, GetX, (GetClipMaxY - 425) + 30);
yield;
}
}
}
task PongBall(InitSpeed)
{
if(Obj_BeDeleted(Ball))
{
Ball = Obj_Create(OBJ_SHOT);
Obj_SetPosition(Ball, GetCenterX, GetCenterY);
Obj_SetCollisionToPlayer(Ball, true);
Obj_SetCollisionToObject(Ball, true);
ObjShot_SetDelay(Ball, 10);
ObjShot_SetGraphic(Ball, 9);
ObjShot_SetBombResist(Ball, true);
Obj_SetAngle(Ball, Dir[rand_int(0, 3)]);
Obj_SetSpeed(Ball, InitSpeed);
Obj_SetAlpha(Ball, 255);
}
while(! Obj_BeDeleted(Ball))
{
if(timer > 0)
{
timer--;
}
if(Obj_GetX(Ball) <= GetClipMinX())
{
Angle = 0;
loop(36)
{
Speed2 = 3;
let stop = 0;
let shot = 0;
loop(10)
{
CreateShotA(shot, Obj_GetX(Ball), Obj_GetY(Ball), 15);
if(stop%2 == 0)
{
SetShotDataA(shot, 0, Speed2, Angle, 0.5, 0, 0, 3);
SetShotDataA(shot, 240, NULL, NULL, 0, 0, 0, 3);
}
else
{
SetShotDataA(shot, 0, Speed2, Angle, -0.5, 0, 0, 3);
SetShotDataA(shot, 240, NULL, NULL, 0, 0, 0, 3);
}
FireShot(shot);
shot++;
Speed2 -= 0.25;
stop++;
}
Angle += 10;
}
Obj_SetAngle(Ball, 180-Obj_GetAngle(Ball));
}
if(Obj_GetX(Ball) >= GetClipMaxX())
{
Angle = 180;
loop(36)
{
Speed2 = 3;
let stop = 0;
let shot = 0;
loop(10)
{
CreateShotA(shot, Obj_GetX(Ball), Obj_GetY(Ball), 15);
if(stop%2 == 0)
{
SetShotDataA(shot, 0, Speed2, Angle, -0.5, 0, 0, 3);
SetShotDataA(shot, 240, NULL, NULL, 0, 0, 0, 3);
}
else
{
SetShotDataA(shot, 0, Speed2, Angle, 0.5, 0, 0, 3);
SetShotDataA(shot, 240, NULL, NULL, 0, 0, 0, 3);
}
FireShot(shot);
shot++;
Speed2 -= 0.25;
stop++;
}
Angle -= 10;
}
Obj_SetAngle(Ball, 180-Obj_GetAngle(Ball));
}
if(Collision_Obj_Obj(Ball, Paddle1) == true && timer == 0)
{
let shot = 0;
Angle = rand_int(0, 359);
let stop = 0;
loop(100)
{
CreateShotA(shot, Obj_GetX(Ball), Obj_GetY(Ball), 5);
SetShotDataA(shot, 0, 2, Angle, 0, 0, 0, 7);
SetShotDataA(shot, 20, NULL, NULL, -2, 0, 0, 7);
if(stop%2 == 0)
{
SetShotDataA(shot, 180, NULL, NULL, -1, 0, 0, 7);
}
else
{
SetShotDataA(shot, 180, NULL, NULL, 1, 0, 0, 7);
}
SetShotDataA(shot, 240, NULL, NULL, 0, 0, 0, 7);
FireShot(shot);
if(stop%2 == 0)
{
CreateShot01(GetX, GetY, 2, Angle, 7, 5);
}
stop++;
Angle += 3.6;
shot++;
}
Angle = rand_int(180, 216);
let Angle2 = rand_int(0, 36);
let Angle3 = rand_int(0, 36);
loop(60)
{
CreateShot01(GetX, GetY, 1, Angle, 8, 0);
CreateShot01(GetX, GetY, 1.5, Angle2, 8, 10);
CreateShot01(GetX, GetY, 2, Angle3, 8, 15);
Angle += 6;
Angle2 += 6;
Angle3 += 6;
}
let position = Obj_GetY(Paddle1) - Obj_GetY(Ball);
Obj_SetY(Ball, Obj_GetY(Paddle1) - position);
timer = 30;
Obj_SetAngle(Ball, 360-Obj_GetAngle(Ball));
BounceCount++;
}
if(Collision_Obj_Obj(Ball, Paddle2) == true && timer == 0)
{
let shot = 0;
Angle = rand_int(0, 359);
let stop = 0;
loop(100)
{
CreateShotA(shot, Obj_GetX(Ball), Obj_GetY(Ball), 5);
SetShotDataA(shot, 0, 2, Angle, 0, 0, 0, 7);
SetShotDataA(shot, 20, NULL, NULL, 2, 0, 0, 7);
if(stop%2 == 0)
{
SetShotDataA(shot, 180, NULL, NULL, 1, 0, 0, 7);
}
else
{
SetShotDataA(shot, 180, NULL, NULL, -1, 0, 0, 7);
}
SetShotDataA(shot, 240, NULL, NULL, 0, 0, 0, 7);
FireShot(shot);
if(stop%2 == 0)
{
CreateShot01(GetX, GetY, 2, Angle, 7, 5);
}
stop++;
Angle += 3.6;
shot++;
}
Angle = rand_int(0, 36);
let Angle2 = rand_int(0, 36);
let Angle3 = rand_int(0, 36);
loop(60)
{
CreateShot01(GetX, GetY, 1, Angle, 8, 0);
CreateShot01(GetX, GetY, 1.5, Angle2, 8, 10);
CreateShot01(GetX, GetY, 2, Angle3, 8, 15);
Angle += 6;
Angle2 += 6;
Angle3 += 6;
}
let position = Obj_GetY(Paddle2) - Obj_GetY(Ball);
Obj_SetY(Ball, Obj_GetY(Paddle2) - position);
timer = 30;
Obj_SetAngle(Ball, 360-Obj_GetAngle(Ball));
BounceCount++;
}
if(Obj_GetY(Ball) >= GetClipMaxY())
{
Obj_Delete(Ball);
}
if(Obj_GetY(Ball) <= GetClipMinY())
{
Obj_Delete(Ball);
}
if(Obj_GetX(Ball) > GetX)
{
SetX(GetX + 3);
}
if(Obj_GetX(Ball) < GetX)
{
SetX(GetX - 3);
}
Obj_SetSpeed(Ball, InitSpeed + (BounceCount / 5));
Angle = rand_int(0, 360);
let stop = 0;
if(frame2 == 0)
{
loop(10)
{
if(stop%2 == 0)
{
CreateShot01(Obj_GetX(Ball), Obj_GetY(Ball), 1.5, Angle, 10, 0);
}
else
{
CreateShot01(Obj_GetX(Ball), Obj_GetY(Ball), 1.5, Angle, 11, 0);
}
stop++;
Angle += 36;
}
frame2 = -60;
}
frame2++;
yield;
}
}
@Initialize
{
LoadGraphic(BossImage);
SetLife(512);
SetDamageRate(10,10);
SetTimer(152);
SetInvincibility(30);
CutIn(YOUMU, "Destroyer "\""Chenball"\", BossCutIn, 0, 0, 256, 320);
SetScore(70000);
SetEnemyMarker(true);
MagicCircle(true);
SetMovePosition02(GetCenterX,(GetClipMaxY - 425),30);
LoadUserShotData(GetCurrentScriptDirectory ~ "PongShot.txt");
}
@MainLoop
{
SetCollisionA(GetX(),GetY(),32);
SetCollisionB(GetX(),GetY(),24);
if(Obj_BeDeleted(Ball))
{
BallExist = false;
BounceCount = 0;
}
if(PaddleExist == true)
{
Pong(0);
Pong(1);
}
if(BallExist == true)
{
PongBall(Settings1);
}
if(frame == -60)
{
SetColor(255, 255, 255);
Concentration01(60);
}
if(frame == 0)
{
if(PaddleExist == false)
{
PaddleExist = true;
}
if(BallExist == false)
{
BallExist = true;
if(Wait == 4)
{
Settings1 = rand(0.5, 3);
PongBall(Settings1);
Wait = 0;
}
Wait++;
}
frame = -20;
}
frame++;
}
@DrawLoop
{
SetTexture(BossImage);
SetGraphicRect(40,33,91,94);
DrawGraphic(GetX, GetY);
}
@Finalize
{
DeleteGraphic(BossImage);
}
}
--- End code ---
--- Code: ---#PlayerShotData
ShotImage = ".\Pong.png"
ShotData
{
id = 1 //ID
rect = (32,0,64,32)
angular_velocity = 2
}
ShotData
{
id = 2 //ID
rect = (128,0,192,64)
angular_velocity = 2
}
ShotData
{
id = 3 //ID
rect = (38,56,58,76)
angular_velocity = 1
}
ShotData
{
id = 4 //ID
rect = (73,69,117,78)
angular_velocity = 0
}
ShotData
{
id = 5 //ID
rect = (0,0,32,32)
angular_velocity = 2
}
ShotData
{
id = 6 //ID
rect = (64,0,128,64)
angular_velocity = 2
}
ShotData
{
id = 7 //ID
rect = (21,36,37,54)
angular_velocity = 0
}
ShotData
{
id = 8 //ID
rect = (8,51,22,72)
angular_velocity = 0
}
ShotData
{
id = 9 //CHEEEEEENNNNNBAAAAAAAAAAALL
rect = (197,3,237,66)
angular_velocity = 4
}
ShotData
{
id = 10 //Chenball shot
rect = (131,68,137,85)
angular_velocity = 0
}
ShotData
{
id = 11 //Chenball shot
rect = (141,68,147,85)
angular_velocity = 0
}
--- End code ---
Ask and you shall receive~! It's CHENBALL! Might be too hard, though. (And by "too hard", I mean "very very VERY unfair".)