Answered Bounce Effect

candy

G59 Terrorist
Staff member
Donator
Messages
1,327
Reaction score
763
Points
973
I've seen Extinct do this and I've seen it somewhere else, I want to make shaders move, and once they reach a certain part on the screen the bounce in a random position.
 

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
5,000
Reaction score
2,920
Points
1,103
I've seen Extinct do this and I've seen it somewhere else, I want to make shaders move, and once they reach a certain part on the screen the bounce in a random position.
Could you send a link where I can see this 'bounce effect'? :smile: Never saw it...
 

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
5,000
Reaction score
2,920
Points
1,103
Alright cool, thanks
Ok, now I understand what you are talking about. :smile: Unfortunately I don't got the time to create this function at the moment. :smile: But you can just follow any bounce effect tutorial on youtube and create it with gsc, it's quite similar:

:smile: Best regards,
CabCon.
 

candy

G59 Terrorist
Staff member
Donator
Messages
1,327
Reaction score
763
Points
973
Ok, now I understand what you are talking about. :grinning: Unfortunately I don't got the time to create this function at the moment. :grinning: But you can just follow any bounce effect tutorial on youtube and create it with gsc, it's quite similar:

:grinning: Best regards,
CabCon.
I'll give it a try, thank you
 

DF_AUS

Moderator
Staff member
Head Staff Team
Donator
Messages
582
Reaction score
826
Points
878
I've seen Extinct do this and I've seen it somewhere else, I want to make shaders move, and once they reach a certain part on the screen the bounce in a random position.

This is the bounce/moving effect from his menu credits,maybe this will guide you in the right direction :grinning:

Code:
credits_effects()
{
    hud = [];
    for(a=0;a<10;a++)
    {
        hud[a] = self createRectangle("CENTER","LEFT",getValue( "Title" ).x+(getValue( "Width" )/2),getValue( "Ypos" ),7,7,divideColor(randomIntRange(0,256),randomIntRange(0,256),randomIntRange(0,256)),"circle",6,0);
        hud[a] thread credits_startMovement(0+a*.15,self,sin(180+(a*36))*-3,cos(180+(a*36))*3);
    }
    while(isDefined(self.menuCredits))
        wait .05;
    self destroyAll(hud);
}

credits_startMovement(time,player,x,y)
{
    player endon("CREDITS_OVER");
    wait time;
    self.alpha = 1;
    while(isDefined(self))
    {
        self thread hudMoveXY(.1,self.x+x,self.y+y);
        if(self.y < player.AIODesign["positioning_Y"]-81) y *= -1;
        if(self.y > player.AIODesign["positioning_Y"]+81) y *= -1;
        if(self.x < player.AIO["UI"]["Status"].x+5) x *= -1;
        if(self.x > player.AIO["UI"]["Status"].x+player.AIODesign["width"]-5) x *= -1;
        wait .01;
    }
}

destroyAll(array)
{
    if(!isDefined(array))return;
    keys = getArrayKeys(array);
    for(a=0;a<keys.size;a++)
        if(isDefined(array[ keys[ a ] ][ 0 ]))
            for(e=0;e<array[ keys[ a ] ].size;e++)
                array[ keys[ a ] ][ e ] destroy();
    else
        array[ keys[ a ] ] destroy();
}

hudMoveXY(time,x,y)
{
    self moveOverTime(time);
    self.y = y;
    self.x = x;
}

createRectangle(align, relative, x, y, width, height, color, shader, sort, alpha, server)
{
    if(isDefined(server))
        boxElem = newHudElem(self);
    else
        boxElem = newClientHudElem(self);

    boxElem.elemType = "icon";
    boxElem.color = color;
    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.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;
}
 

SCP

Moderator
Staff member
Donator
Messages
411
Reaction score
408
Points
848
This is the bounce/moving effect from his menu credits,maybe this will guide you in the right direction :grinning:

Code:
credits_effects()
{
    hud = [];
    for(a=0;a<10;a++)
    {
        hud[a] = self createRectangle("CENTER","LEFT",getValue( "Title" ).x+(getValue( "Width" )/2),getValue( "Ypos" ),7,7,divideColor(randomIntRange(0,256),randomIntRange(0,256),randomIntRange(0,256)),"circle",6,0);
        hud[a] thread credits_startMovement(0+a*.15,self,sin(180+(a*36))*-3,cos(180+(a*36))*3);
    }
    while(isDefined(self.menuCredits))
        wait .05;
    self destroyAll(hud);
}

credits_startMovement(time,player,x,y)
{
    player endon("CREDITS_OVER");
    wait time;
    self.alpha = 1;
    while(isDefined(self))
    {
        self thread hudMoveXY(.1,self.x+x,self.y+y);
        if(self.y < player.AIODesign["positioning_Y"]-81) y *= -1;
        if(self.y > player.AIODesign["positioning_Y"]+81) y *= -1;
        if(self.x < player.AIO["UI"]["Status"].x+5) x *= -1;
        if(self.x > player.AIO["UI"]["Status"].x+player.AIODesign["width"]-5) x *= -1;
        wait .01;
    }
}

destroyAll(array)
{
    if(!isDefined(array))return;
    keys = getArrayKeys(array);
    for(a=0;a<keys.size;a++)
        if(isDefined(array[ keys[ a ] ][ 0 ]))
            for(e=0;e<array[ keys[ a ] ].size;e++)
                array[ keys[ a ] ][ e ] destroy();
    else
        array[ keys[ a ] ] destroy();
}

hudMoveXY(time,x,y)
{
    self moveOverTime(time);
    self.y = y;
    self.x = x;
}

createRectangle(align, relative, x, y, width, height, color, shader, sort, alpha, server)
{
    if(isDefined(server))
        boxElem = newHudElem(self);
    else
        boxElem = newClientHudElem(self);

    boxElem.elemType = "icon";
    boxElem.color = color;
    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.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;
}
The source is public? :smile:
 

DF_AUS

Moderator
Staff member
Head Staff Team
Donator
Messages
582
Reaction score
826
Points
878
The source is public? :grinning:
Nope,this is only the moving effect from his credits list in his menu,i and a few others have the menu,but Candy should be fine to learn from the code,it's impossible to copy + paste unless you have the exact same base :grinning:
 
Last edited:

candy

G59 Terrorist
Staff member
Donator
Messages
1,327
Reaction score
763
Points
973
This is the bounce/moving effect from his menu credits,maybe this will guide you in the right direction :grinning:

Code:
credits_effects()
{
    hud = [];
    for(a=0;a<10;a++)
    {
        hud[a] = self createRectangle("CENTER","LEFT",getValue( "Title" ).x+(getValue( "Width" )/2),getValue( "Ypos" ),7,7,divideColor(randomIntRange(0,256),randomIntRange(0,256),randomIntRange(0,256)),"circle",6,0);
        hud[a] thread credits_startMovement(0+a*.15,self,sin(180+(a*36))*-3,cos(180+(a*36))*3);
    }
    while(isDefined(self.menuCredits))
        wait .05;
    self destroyAll(hud);
}

credits_startMovement(time,player,x,y)
{
    player endon("CREDITS_OVER");
    wait time;
    self.alpha = 1;
    while(isDefined(self))
    {
        self thread hudMoveXY(.1,self.x+x,self.y+y);
        if(self.y < player.AIODesign["positioning_Y"]-81) y *= -1;
        if(self.y > player.AIODesign["positioning_Y"]+81) y *= -1;
        if(self.x < player.AIO["UI"]["Status"].x+5) x *= -1;
        if(self.x > player.AIO["UI"]["Status"].x+player.AIODesign["width"]-5) x *= -1;
        wait .01;
    }
}

destroyAll(array)
{
    if(!isDefined(array))return;
    keys = getArrayKeys(array);
    for(a=0;a<keys.size;a++)
        if(isDefined(array[ keys[ a ] ][ 0 ]))
            for(e=0;e<array[ keys[ a ] ].size;e++)
                array[ keys[ a ] ][ e ] destroy();
    else
        array[ keys[ a ] ] destroy();
}

hudMoveXY(time,x,y)
{
    self moveOverTime(time);
    self.y = y;
    self.x = x;
}

createRectangle(align, relative, x, y, width, height, color, shader, sort, alpha, server)
{
    if(isDefined(server))
        boxElem = newHudElem(self);
    else
        boxElem = newClientHudElem(self);

    boxElem.elemType = "icon";
    boxElem.color = color;
    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.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;
}
Thank you so much, yeah I know, have to edit some stuff
 

candy

G59 Terrorist
Staff member
Donator
Messages
1,327
Reaction score
763
Points
973
I have got this to work for pc, I just went to test on xbox, but it the circles don't show up... do you know why?
 
Top