Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Nailik

Hey There,

I might just be using the wrong search terms, but I haven't found a resolution in the forums. I'm fairly new at this so I apologize.

I'm using the mover and void from the biolab pack the only changes I made to the mover was an increase in speed, the image and the size to fit the image. But I'm having two issues.

The image for the mover shows up in weltmeister but not in the game on runtime.

and

When the player is on this 'invisible' platform the velocity is making it think it's jumping or falling so that it can't jump to the next.

Any help or direction to a thread with a solution is appreciated.

1 decade ago by paulh

http://impactjs.com/forums/help/moving-platforms has some discussion on it

There was also a plugin for movers and platforms but i cant seem to find it, i think it was from alexandre, their was a suggestion of something like sticky:true, to make entities stick to moving platforms ..sorry i cant be more help, best bet is to post your code.

1 decade ago by alexandre

There was also a plugin for movers and platforms but i cant seem to find it, i think it was from alexandre, their was a suggestion of something like sticky:true, to make entities stick to moving platforms


right here

1 decade ago by Nailik

Thanks guys I'll check those out, I saw that moving platforms one, but not the sticky thing, I'll check it out and if I'm still having issues I'll post code, I didn't bother since I hadn't changed the biolab code (other than the 3 variables).

1 decade ago by Nailik

after comparison it looks like I must have mucked something up with the size for when it went invisible.

However the sticky: true thing didn't seem to fix the jump at the end part. I'll keep playing with it. (the check:function is just me playing around as a temporary fix to the falling/jumping animation while on the mover, I have a large detailed sprite for the player so the animation's REALLY noticable)

ig.module(
    'game.entities.mover'
)
    .requires(
    'impact.entity'
)
    .defines(function(){

        EntityMover = ig.Entity.extend({
            size: {x: 80, y: 16},
            maxVel: {x: 100, y: 100},

            type: ig.Entity.TYPE.NONE,
            checkAgainst: ig.Entity.TYPE.A,
            collides: ig.Entity.COLLIDES.FIXED,

            target: null,
            targets: [],
            currentTarget: 0,
            speed: 60,
            gravityFactor: 0,
            sticky: true,

            animSheet: new ig.AnimationSheet( 'media/test-platform.png', 80, 16 ),


            init: function( x, y, settings ) {
                this.addAnim( 'idle', 1, [0] );
                this.parent( x, y, settings );

                // Transform the target object into an ordered array of targets
                this.targets = ig.ksort( this.target );
            },


            update: function() {
                var oldDistance = 0;
                var target = ig.game.getEntityByName( this.targets[this.currentTarget] );
                if( target ) {
                    oldDistance = this.distanceTo(target);

                    var angle = this.angleTo( target );
                    this.vel.x = Math.cos(angle) * this.speed;
                    this.vel.y = Math.sin(angle) * this.speed;
                }
                else {
                    this.vel.x = 0;
                    this.vel.y = 0;
                }


                this.parent();

                // Are we close to the target or has the distance actually increased?
                // -> Set new target
                var newDistance = this.distanceTo(target);
                if( target && (newDistance > oldDistance || newDistance < 0.5) ) {
                    this.pos.x = target.pos.x + target.size.x/2 - this.size.x/2;
                    this.pos.y = target.pos.y + target.size.y/2 - this.size.y/2;
                    this.currentTarget++;
                    if( this.currentTarget >= this.targets.length && this.targets.length > 1 ) {
                        this.currentTarget = 0;
                    }
                }
            },
            check: function( other ) {
                if( other.vel.x != 0 ) {
                    other.currentAnim = other.anims.run;
                }else{
                    other.currentAnim = other.anims.idle;
                }

                other.currentAnim.flip.x = other.flip;
            }
        });

    });

1 decade ago by GP

I have the same problem, when on the moving platform, my player slide over it depending of the speed of the movers.
Do you find a way to make the platform sticky ?
Page 1 of 1
« first « previous next › last »