- Messages
- 375
- Reaction score
- 148
- Points
- 903
Hey guys, whats up , anyways i'm trying to convert flappybirds from cod waw
and i have most of it working correctly but i need help, if u can please help....
if u can or want to help skype: juggloswag
and i have most of it working correctly but i need help, if u can please help....
PHP:
#include maps\mp\_utility;
#include common_scripts\utility;
#include maps\mp\gametypes\_hud_util;
#include maps\mp\gametypes\_hud_message;
#include maps\_destructible_types;
init()
{
level thread onPlayerConnect();
}
onPlayerConnect()
{
for(;;)
{
level waittill("connected", player);
player thread onPlayerSpawned();
}
}
onPlayerSpawned()
{
self endon("disconnect");
level endon("game_ended");
for(;;)
{
self waittill("spawned_player");
self thread FlappyPrintStart();
}
}
FlappyPrintStart()
{
self thread flappyBird();
for(;;)
{
self iprintln("FlappyBirds ^F^1Test");
}
}
flappyBird() {
//close menu founction
//Delete Any Hud On Screen Etc Goes Here In A Thread
self setDvar("ammoCounterHide", 1);
self setDvars("ui_hud_hardcore", 1, "cg_drawCrosshair", 0);
self freezeControls(true);
self.FlappyGame = true;
hud = [];
bird = [];
pipe = [];
hud["bg"] = self createRectangle("CENTER", "CENTER", 0, 0, 1000, 1000, divideColor(120, 255, 255), "white", -12, 1);
hud["bg_bot"] = self createRectangle("BOTTOM", "BOTTOM", 0, 100, 1000, 130, divideColor(255, 230, 192), "white", -7, 1);
hud["bg_strip"] = self createRectangle("BOTTOM", "BOTTOM", 0, -20, 1000, 20, divideColor(97, 255, 113), "white", -6, 1);
bird = self createBird();//Bird Hud
self thread floatWaitingFlappy(bird);//Another Thread Needed
self thread initFlappyOptions(bird, hud, pipe);//A Thread
self waittill("ExitFlappy");
//add a thread to remake menu/or reopen menu
}
exitFlappyBird(bird, hud, pipe, end) {
self notify("ExitFlappy");
self.FlappyGame = undefined;
self.FlappyGameOver = undefined;
self destroyAll(bird);
self destroyAll(pipe);
self destroyAll(hud);
self destroyAll(end);
self freezeControls(false);
self setDvars("ui_hud_hardcore", 0, "cg_drawCrosshair", 1, "ammoCounterHide", 0);
//open menu/unlock...?
}
createBird() {
bird = [];
bird[0] = self createRectangle("CENTER", "CENTER", 0, 0, 45, 60, divideColor(255, 135, 135), "ui_sliderbutt_1", 1, 1);
bird[1] = self createRectangle("CENTER", "CENTER", bird[0].x - 16, bird[0].y, 22, 26, divideColor(123, 197, 200), "ui_sliderbutt_1", 2, 1);
bird[2] = self createRectangle("CENTER", "CENTER", bird[0].x + 9, bird[0].y - 4, 24, 34, (1, 1, 1), "ui_sliderbutt_1", 2, 1);
bird[3] = self createRectangle("CENTER", "CENTER", bird[2].x + 5, bird[2].y + 1, 2, 3, (0, 0, 0), "white", 3, 1);
bird[4] = self createRectangle("CENTER", "CENTER", bird[3].x - 1, bird[3].y + 10, 25, 20, divideColor(255, 255, 130), "ui_sliderbutt_1", 3, 1);
bird[5] = self createRectangle("CENTER", "CENTER", bird[4].x + 3, bird[4].y, 14, 1, divideColor(131, 131, 122), "white", 4, 1);
self.flappyBirdPosition = [];
for (a = 0; a < 6; a++) self.flappyBirdPosition[a] = bird[a].y;
return bird;
}
tempFlappy() {
temp = [];
temp[0] = self createRectangle("CENTER", "CENTER", 0, -10, 45, 60, (1, 1, 1), "ui_sliderbutt_1", 1, 1);
temp[1] = self createRectangle("CENTER", "CENTER", temp[0].x - 16, temp[0].y, 22, 26, (1, 1, 1), "ui_sliderbutt_1", 2, 1);
temp[2] = self createRectangle("CENTER", "CENTER", temp[0].x + 9, temp[0].y - 4, 24, 34, (1, 1, 1), "ui_sliderbutt_1", 2, 1);
temp[3] = self createRectangle("CENTER", "CENTER", temp[2].x + 5, temp[2].y + 1, 2, 3, divideColor(131, 131, 122), "white", 3, 1);
temp[4] = self createRectangle("CENTER", "CENTER", temp[3].x - 1, temp[3].y + 10, 25, 20, (1, 1, 1), "ui_sliderbutt_1", 3, 1);
temp[5] = self createRectangle("CENTER", "CENTER", temp[4].x + 3, temp[4].y, 14, 1, divideColor(131, 131, 122), "white", 4, 1);
temp[6] = self createText("bigfixed", 1, "CENTER", "CENTER", 0, 40, 8, 1, "Tap-- [{+activate}] --Tap");//Created Text
self waittill("flapping");
for (a = 0; a < temp.size; a++) temp[a] thread hudFadenDestroy(0, .4);
}
floatWaitingFlappy(bird) {
self endon("ExitFlappy");
self endon("EnterFlappy");
self endon("flapping");
num = 20;
while (1) {
for (a = 0; a < 6; a++) bird[a] thread hudMoveY(bird[a].y + num, .55);
num = num * -1;
wait .6;
}
}
initFlappyOptions(bird, hud, pipe) {
self endon("ExitFlappy");
if (!isDefined(self.FlappyGameOver)) hud["Title"] = self createText("bigfixed", 2, "CENTER", "CENTER", 0, -60, 1, 1, "FlappyBird");
else hud["Title"] = self createText("bigfixed", 2, "CENTER", "CENTER", 0, -60, 1, 1, "^6Game Over");
gameOverHud = self runGameOverScreen();
hud[0] = self createRectangle("BOTTOM", "BOTTOM", -100, hud["bg_strip"].y - 25, 110, 50, (0, 1, 0), "white", 7, 0);
hud[1] = self createRectangle("BOTTOM", "BOTTOM", 100, hud["bg_strip"].y - 25, 100, 40, (1, 0, 0), "white", 7, 0);
hud[2] = self createText("default", 1.4, "BOTTOM", "BOTTOM", 0, hud["bg_strip"].y - 2, 3, 0, "^2Play FlappyBird");
for (a = 0; a < 3; a++) hud[a] thread hudFade(1, .25);
wait .3;
curs = 0;
while (1) {
wait .05;
if (self adsButtonPressed() || self attackButtonPressed()) {
self playSound("deny");
oldCurs = curs;
curs += self attackButtonPressed();
curs -= self adsButtonPressed();
if (curs < 0) curs = 1;
if (curs > 1) curs = 0;
hud[oldCurs] scaleOverTime(.3, 100, 40);
wait .25;
if (curs == 0) hud[2] setText("^2Play FlappyBird");
if (curs == 1) hud[2] setText("^1Exit FlappyBird");
hud[curs] scaleOverTime(.3, 110, 50);
wait .25;
}
if (self useButtonPressed()) {
self.initFlappyOptions = undefined;
self.FlappyBirdTop = undefined;
self.FlappFallingCounter = undefined;
self playSound("deny");
hud[curs] scaleOverTime(.3, 100, 40);
wait .25;
hud[curs] scaleOverTime(.3, 110, 50);
wait .25;
if (curs == 0) break;
if (curs == 1) self thread exitFlappyBird(bird, hud, pipe, gameOverHud);
return;
}
}
self.flappScore = 0;
bird["wink"] = self createRectangle("CENTER", "CENTER", 0, 0, 1000, 1000, (0, 0, 0), "white", 9, 0);
bird["wink"] hudFade(1, .6);
wait .6;
if (!isDefined(self.FlappyGameOver))
for (a = 0; a < 6; a++) bird[a] thread hudMoveX(bird[a].x - 200, .05);
else {
for (a = 0; a < 6; a++) bird[a] thread hudMoveY(self.flappyBirdPosition[a], .05);
self thread floatWaitingFlappy(bird);
}
self.FlappyGameOver = undefined;
self destroyAll(gameOverHud);
for (a = 0; a < 3; a++) hud[a] destroy();
self thread tempFlappy();
bird["score"] = self createText("bigfixed", 1.35, "TOP", "TOP", 0, 20, 5, 1, "0");
hud["Title"] setText("^2Get Ready!");
wait .15;
bird["wink"] hudFadenDestroy(0, .6);
wait .5;
self thread controlFlappy(bird);
self thread doFlappyLoop(bird, hud, pipe);
self waittill("flapping");
hud["Title"] thread hudFadenDestroy(0, .4);
self notify("EnterFlappy");
if (!isDefined(self.FlappyGameOver)) self thread marioPipes(bird, hud, pipe);
}
runGameOverScreen() {
if (!isDefined(self.FlappyGameOver)) return undefined;
hud = [];
if (self.flappScore > self.menu["flappBestScore"]) {
self.menu["flappBestScore"] = self.flappScore;
self setSavedVariable("113", self.menu["flappBestScore"]);
if (isConsole()) updateGamerProfile();
}
wait .5;
hud[0] = self createRectangle("CENTER", "CENTER", 0, 350, 225, 50, divideColor(205, 226, 118), "white", 7, 1);
hud[1] = self createText("default", 1.5, "CENTER", "CENTER", 0, 340, 8, 1, "Score: " + self.flappScore);
hud[2] = self createText("default", 1.5, "CENTER", "CENTER", 0, 360, 8, 1, "Best: " + self.menu["flappBestScore"]);
hud[0] thread hudMoveY(20, .6);
hud[1] thread hudMoveY(hud[0].y - 10, .6);
hud[2] thread hudMoveY(hud[0].y + 10, .6);
wait 1;
return hud;
}
doFlappyLoop(bird, hud, pipe) {
while (1) {
if (bird[5].y >= 180) {
self.FlappyGameOver = true;
bird["score"] destroy();
self thread initFlappyOptions(bird, hud, pipe);
self notify("flappyCollision");
self notify("flapping");
break;
}
if (bird[0].y <= -215) {
self.FlappyBirdTop = true;
self notify("flapping");
wait .1;
for (a = 0; a < 2; a++) self thread flappyFall(bird, 2);
wait .15;
self.FlappyBirdTop = undefined;
}
wait .05;
}
}
controlFlappy(bird) {
self endon("flappyCollision");
while (1) {
if (self useButtonPressed() && !isDefined(self.FlappyBirdTop)) {
self thread flappySemiFly(bird);
while (self useButtonPressed()) wait .01;
}
wait .01;
}
}
flappySemiFly(bird) {
self notify("flapping");
self endon("flapping");
num = 0;
while (1) {
for (a = 0; a < 6; a++) bird[a] thread hudMoveY(bird[a].y - 14, .05);
num++;
if (num > 3) break;
wait 0.05;
}
wait .15;
for (a = 0; a < 2; a++) self thread flappyFall(bird, 4);
}
flappyFall(bird, val) {
self endon("flapping");
while (1) {
for (a = 0; a < 6; a++) bird[a] thread hudMoveY(bird[a].y + val, 0.05);
wait 0.05;
if (val < 7) val++;
}
}
marioPipes(bird, hud, pipe) {
self endon("flappyCollision");
tok = strTok("tube|tube2|cap|cap2|tube3|tube4|cap3|cap4|tube5|tube6|cap5|cap6", "|");
wait 2.5;
while (1) {
pipe = [];
for (a = 0; a < 3; a++) {
length = randomIntRange(70, 485);
pipe[tok[pipe.size]] = self createRectangle("CENTER", "CENTER", 470, -230, 100, length, divideColor(35, 205, 35), "white", -8, 1);
pipe[tok[pipe.size]] = self createRectangle("CENTER", "CENTER", 470, -230 + ((length / 2) + 295), 100, 300, divideColor(35, 205, 35), "white", -8, 1);
pipe[tok[pipe.size]] = self createRectangle("CENTER", "CENTER", 470, pipe[tok[4 * a]].y + ((length / 2) - 15), 110, 30, divideColor(19, 190, 19), "white", -1, 1);
pipe[tok[pipe.size]] = self createRectangle("CENTER", "CENTER", 470, pipe[tok[4 * a + 1]].y - 150, 110, 30, divideColor(19, 190, 19), "white", -1, 1);
for (b = a * 4; b < pipe.size; b++) pipe[tok[b]] thread movePipes(self);
wait 1.3;
self thread checkPipeCollision(pipe[tok[2 + 4 * a]], pipe[tok[3 + 4 * a]], bird, pipe, hud);
}
wait .05;
}
}
movePipes(me) {
me endon("flappyCollision");
self endon("PipesDeleted");
self thread waitForCollision(me);
self hudMoveX(self.x - 1000, 3.5);
if (isDefined(self)) self destroy();
}
waitForCollision(me) {
me waittill_any("FlappyCollider", "flappyCollision");
self destroy();
}
checkPipeCollision(pipe, pipe2, bird, pip, hud) {
self endon("flappyCollision");
wait .85;
pipe endon("PipeCollision");
pipe thread collisionCount(self, bird);
while (1) {
if (bird[0].y - 15 < pipe.y + 15 || bird[0].y + 25 > pipe2.y - 15) {
bird["score"] destroy();
self notify("flapping");
for (a = 0; a < 2; a++) self thread flappyFall(bird, 4);
self notify("flappyCollision");
}
wait 0.05;
}
}
collisionCount(me, bird) {
me endon("flappyCollision");
wait .45;
me playSound("cha_ching");
me.flappScore++;
bird["score"] setText(me.flappScore);
self notify("PipeCollision");
}
divideColor(c1, c2, c3)
{
return (c1 / 255, c2 / 255, c3 / 255);
}
if u can or want to help skype: juggloswag