All The Impossible Game - Release

Discussion in 'Call of Duty: WaW Modding' started by jordb, Sep 14, 2018 at 9:33 AM with 0 replies and 52 views.

  1. jordb

    jordb Developer Premium

    Messages:
    18
    Ratings:
    20
    information;
    Code:
    • infinite gameplay
    • randomly generated jumps
    • block collision
    
    instructions;
    Code:
    thread IGInit();
    
    images;
    [​IMG]
    [​IMG]
    [​IMG]

    script;
    Code:
    IGInit()
    {
        level.attempts = 1;
        level.stageTime = .01;
        level.stageTime2 = .02;
        level.enemyColor = divideColor(0,0,0);
        level.blockWait = .08;
        self thread buildGame();
        //self thread lockMenu("ALL");
        self freezeControls(true);
        //self thread godCheck();
    }
    buildGame()
    {
        level.character = []; level.gameHuds = [];
      
        level.gameHuds[1] = self createRectangle("CENTER", "CENTER", 0, 0, 1, 1, divideColor(52,158,172), "white", 0,1);
        level.gameHuds[1] thread hudScaleOverTime(.55, 950, 950); wait .6;
    
        level.gameHuds[2] = self createRectangle("CENTER", "CENTER", 0, 100, 700, 1, divideColor(255,255,255), "white_line_faded_center", 1,1);
        level.character[0] = self createRectangle("CENTER", "CENTER", level.gameHuds[2].x-150, level.gameHuds[2].y-16, 30, 30, divideColor(0,0,0), "white", 1,1);
        level.character[1] = self createRectangle("CENTER", "CENTER", level.gameHuds[2].x-150, level.gameHuds[2].y-16, 26, 26, divideColor(220,76,6), "white", 2,1);
        level.character[2] = self createRectangle("CENTER", "CENTER", level.gameHuds[2].x-150, level.gameHuds[2].y-16, 20, 20, divideColor(247,113,33), "white", 3, .65);
        self thread gameInstructions();
    }
    gameInstructions()
    {
        self endon("impossible_failed");
        self thread gameControls();
        level.introText = [];
        level.introText[0] = self createText("default", 2, "CENTER", "CENTER", 0, -90, 10, 0, "The Impossible Game", (1,1,1));
        level.introText[1] = self createText("default", 1.3, "CENTER", "CENTER", 0, level.introText[0].y+20, 10, 0, "Created by: ^6jord404", (1,1,1));
        level.introText[0] thread hudFade(1, .55); wait .55;
        level.introText[1] thread hudFade(1, .55); wait 3;
        level.introText[1] thread hudFade(0, .55); wait .55;
        level.introText[0] thread hudFade(0, .55); wait .6;
        level.introText[0] Destroy();
        level.introText[1] Destroy();
        level.gameHuds[0] = self createText("default", 1.3, "TOP", "TOP", 0, 10, 10, 0, "Score: ^20", (1,1,1));
        level.gameHuds[0] thread hudFade(1, .55);
        self thread createBlock();
    }
    gameControls()
    {
        self endon("impossible_failed");
        for(;;)
        {
            if(self useButtonPressed())
            {  
                for(j=0;j<6;j++)
                {  
                    for(a=0;a<3;a++)
                        level.character[a] thread hudMoveY(level.character[a].y - 8, .05);
                    wait .05;
                }
                for(j=0;j<6;j++)
                {  
                    for(a=0;a<3;a++)
                        level.character[a] thread hudMoveY(level.character[a].y + 8, .05);
                    wait .05;
                }
            }
            wait 0.05;
        }
    }
    
    createBlock()
    {
        self endon("impossible_failed");
        if(!isDefined(level.blocks))
            level.blocks = [];
        stage = getRandomStage();
      
        for(j=0;j<stage;j++)
        {
            level.blocks[level.blocks.size] = self createRectangle("CENTER", "CENTER", 350, level.gameHuds[2].y-11, 20, 20, level.enemyColor, "white", 5,0);
            level.blocks[level.blocks.size-1] thread blockCollision( self );
            level.blocks[level.blocks.size-1] thread moveCollisions();
            level.blocks[level.blocks.size-1] thread hudFade(1, .55);
            wait level.blockWait;
        }
        while( isDefined(level.blocks[level.blocks.size-1]) )
            wait .05;
        self thread createBlock();
    }
    getRandomStage()
    {
        result = randomInt(1000);
        if(result <= 250)
            return 3;
        if(result >= 600)
            return 2;
        return 1;
    }
    moveCollisions( value )
    {
        self endon("impossible_failed");
        while( isDefined(self) )
        {
            self thread hudMoveX(self.x - 17, level.stageTime);
            wait level.stageTime2;
        }
    }
    blockCollision( player )
    {
        self endon("impossible_failed");
        while( isDefined(self) )
        {
            if(level.character[0].y >= (self.y - 16) && level.character[0].y <= (self.y + 16) && level.character[0].x >= (self.x - 16) && level.character[0].x <= (self.x + 16))
                player thread impossibleFailed();
            if(self.x <= -260)
                self thread hudFadenDestroy(0, .55);
            wait 0.05;
        }
        level.gameHuds[0] setText("Score: ^2" + level.blocks.size);
    }
    impossibleFailed()
    {
        self notify("impossible_failed");
        for(j=0;j<level.character.size;j++) level.character[j] thread hudFadenDestroy(0, .4);
        for(j=0;j<level.blocks.size;j++) level.blocks[j] thread hudFadenDestroy(0, .4); wait .5;
        level.gameHuds[0] setText("^1GAME OVER!"); wait 4;
        for(j=0;j<level.gameHuds.size;j++) level.gameHuds[j] thread hudFadenDestroy(0, .3);
        //self unlockMenu();
        self freezeControls(false);
    }
    
    additional scripts;
    Code:
    createRectangle(align, relative, x, y, width, height, color, shader, sort, alpha, server)
    {
        if(isDefined(server)) boxElem = newHudElem(self);
        else boxElem = newClientHudElem(self);
        boxElem.elemType = "bar";
        if(!level.splitScreen)
        {
            boxElem.x = -2;
            boxElem.y = -2;
        }
        boxElem.hideWhenInMenu = true;
        boxElem.width = width;
        boxElem.height = height;
        boxElem.align = align;
        boxElem.relative = relative;
        boxElem.xOffset = 0;
        boxElem.yOffset = 0;
        boxElem.children = [];
        boxElem.sort = sort;
        boxElem.color = color;
        boxElem.alpha = alpha;
        boxElem.shader = shader;
        boxElem setParent(level.uiParent);
        boxElem setShader(shader,width,height);
        boxElem.hidden = false;
        boxElem setPoint(align, relative, x, y);
        return boxElem;
    }
    createText(font, fontScale, align, relative, x, y, sort, alpha, text, color)
    {
        textElem = self createFontString(font, fontScale, self);
        textElem setPoint(align, relative, x, y);
        textElem.hideWhenInMenu = true;
        textElem.sort = sort;
        textElem.alpha = alpha;
        textElem.color = color;
        textElem setText(text);
        return textElem;
    }
    hudScaleOverTime(time,width,height)
    {
        self scaleOverTime(time,width,height); wait time;
        self.width = width;
        self.height = height;
    }
    
    hudFadenDestroy(alpha,time,time2)
    {
        if(isDefined(time2)) wait time2;
        self hudFade(alpha,time);
        self destroy();
    }
    
    hudFade(alpha,time)
    {
        self fadeOverTime(time);
        self.alpha = alpha;
        wait time;
    }
    hudMoveY(y,time)
    {
        self moveOverTime(time);
        self.y = y;
        wait time;
    }
    
    hudMoveX(x,time)
    {
        self moveOverTime(time);
        self.x = x;
        wait time;
    }
    divideColor(c1,c2,c3)
    {
        return(c1/255,c2/255,c3/255);
    }
    


     
    • Like Like x 1
    Last edited: Sep 14, 2018 at 11:51 AM

Share This Page