Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

how do i make a char move?

A topic by v.s time dev created Jul 23, 2021 Views: 578 Replies: 12
Viewing posts 1 to 6

i'm trying to make my custom char move like in god eater

If you have a custom stage, then you can do that (and if not then copy stage.hscript), and here's how.

Put these before "function start(song)"

var sh_r  = 1;
var movex = 0;
var movey = 0;
var xup = true;
var yup = true;
var movexby = 0.025;
var moveyby = 0.005;

Put these in "function update(elapsed)"

    var sh_toy = -2480 * movey * sh_r * 0.45;
    var sh_tox = -330 * movex * sh_r;
    dad.x += (sh_tox - dad.x) / 12;
    dad.y += (sh_toy - dad.y) / 12;
    movex += movexby;
    movey += moveyby;
    if (movex >= 2){
        movexby = -0.025;
    }
    if (movex <= -2){
        movexby = 0.025;
    }
    if (movey >= 0.25){
        moveyby = -0.005;
    }
    if (movey <= -0.25){
        moveyby = 0.005;
    }

You should have the enemy moving around, sorta like how it works in God eater.

(1 edit)

or not once i load up the stage it just crashes no 

Can you reply with the code in the hscript?

yea

function start(song) {

    var bg = new FlxSprite(-600, -200).loadGraphic(hscriptPath + 'stageback.png');

    bg.scrollFactor.set(0.9, 0.9);

    bg.antialiasing = true;

    addSprite(bg, BEHIND_ALL);

    var stageFront = new FlxSprite(-650, 600).loadGraphic(hscriptPath + 'stagefront.png');

    stageFront.setGraphicSize(Std.int(stageFront.width * 1.1));

    stageFront.scrollFactor.set(0.9, 0.9);

    stageFront.antialiasing = true;

    stageFront.updateHitbox();

    addSprite(stageFront, BEHIND_ALL);

    var stagecurtains = new FlxSprite(-500, -300).loadGraphic(hscriptPath + 'stagecurtains.png');

    stagecurtains.setGraphicSize(Std.int(stageFront.width * 0.9));

    stagecurtains.scrollFactor.set(1.3, 1.3);

    stagecurtains.updateHitbox();

    stagecurtains.antialiasing = true;

    addSprite(stagecurtains, BEHIND_ALL);

    setDefaultZoom(0.9);

    var sh_r  = 1;

    var movex = 0;

    var movey = 0;

    var xup = true;

    var yup = true;

    var movexby = 0.025;

    var moveyby = 0.005;

}

function beatHit(beat)

{

}

function update(elapsed)

{

    var sh_toy = -2480 * movey * sh_r * 0.45;

    var sh_tox = -330 * movex * sh_r;

    dad.x += (sh_tox - dad.x) / 12;

    dad.y += (sh_toy - dad.y) / 12;

    movex += movexby;

    movey += moveyby;

    if (movex >= 2){

        movexby = -0.025;

    }

    if (movex <= -2){

        movexby = 0.025;

    }

    if (movey >= 0.25){

        moveyby = -0.005;

    }

    if (movey <= -0.25){

        moveyby = 0.005;

    }

}

function stepHit(step)

{

}

function playerTwoTurn()

{

}

function playerTwoMiss()

{

}

function playerTwoSing()

{

}

function playerOneTurn()

{

}

function playerOneMiss()

{

}

function playerOneSing()

{

}

Move the vars and put them before the start function (function start(song) )

ah ok

it should look like this

var sh_r  = 1;
var movex = 0;
var movey = 0;
var xup = true;
var yup = true;
var movexby = 0.025;
var moveyby = 0.005;
function start(song) {

now it works thanks

thanks man

when i tried it

i got this

wait never mind i fexed it