What is causing my sprite to move? (.gif included)

0 favourites
  • 12 posts
From the Asset Store
This is a code so you can see the same skin on all screens (peers). Each peer gets a skin, in addition to 4 directions t
  • I'm having a major problem and I have no explanation for the cause of it. I figured someone must have gone through similar troubles at some point. I would really appreciate the help because this is the first time I've been stuck on something longer than a day.

    This is the second version at the attempt of a more complex enemy sprite. The last revision had failed because of the same reason as this one, except now it's organized more for me to see the complete problem.

    What it's supposed to do: The sword is supposed to launch itself at a -45 degree angle, and stop movement after 0.25 seconds. This is supposed to be about half-way in distance. As you can see, after the 0.25 second point, it continues to move in a weird, inchy-sporadic fashion that I can't explain.

    What makes this more messed up, is that I went into debug mode and checked the sword's properties after the 0.25 second mark. "State" was set to "Stop", and the Custom Movement behavior was disabled.

    The only movement behavior on the sword is Custom Movement.

  • After 0.25 secs, try to zero out Accelerate & Overal speed of CustomMovement

    It would be better to disabled CustomeMovement into separate condition under State="stop".

  • Okay I did that and it worked to some effect, pretty much I'm faced with a new problem:

    For some reason, the orange enemy sprite needs to have a Platformer behavior for any of these functions to kind of work, even though I don't need a Platformer movement at all.

    I believe it is the unnecessary Platformer behavior that is screwing with everything, but when I don't have a Platformer behavior attached to it nothing even starts, the sprite just stays there.

    This is the beginning behavior to the event.

    When the Platformer behavior is removed/disabled, The mirroring does not work, it stays not awake, and the sprite is locked to animation frame '1' when the player is in distance even though I specifically try to lock it to 0.

    I think this is the root of the problem.

  • Have You set the animation speed to 0?

    Seems doesn't have any issue with mine:

    Try make the player to jump in my capx, compare it with Yours

    lancer.capx

  • Yeah, it turns out something it just completely screwed with mine. Your non-platformer sprite mirrors when I jump over it, yet for seemingly no reason at all mine cannot do that without the platformer behavior.

    I might just have to scrap the entire thing and start fresh, something is definitely wrong here.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Could any potential accidental button-presses cause anything like this?

  • Ah if you don't mind, you can send your capx to me and I wiil examine it for you.

  • Can't PM yet, so here, I removed pretty much everything else in the game except the player and this enemy.

    Don't worry at all about any other additional functions of the enemy, it's the simple fact that it needs a Platformer behavior to mirror that's causing all of my issues. I've tested it with the other enemies too, it's the same deal.

    I started a new project from scratch, made three sprites and sure enough, it worked just like yours. So it must be something here that I'm not seeing. If you can't find a solution, I'll just start over and copy all the art assets.

  • Okay first found that to make the enemy mirrored, you must set the awake to true from properties panel. It work that way even without adding platformer behaviour.

    EDIT

    Got it! It had something to do with LineOfSight. By default LineOfSight sees only into Solid object. The Player has not Solid behaviour. So I Changed the Obstacles properties from Solids to Custom. You just need to do that and everything work just fine

  • That almost works!

    Now the issue is that the Enemy can see the player all the time, even when the player is behind a solid wall.

    After I add "On Start of Layout / On Enemy Created -> Add SolidTile to LOS Obstacles", the Enemy takes on the stuck behavior again.

  • I think something exists here that is just beyond explanation. I have remade the system successfully in another .capx.

    The only way that I can recreate this bug happening is by adding a solid behavior to the player, thus screwing with the enemy's LOS behavior.

    Here it is fully working, with no platformer behavior, on standard LOS settings. I really appreciate all of your help, but I think this is a sign that I need to take all assets and settings to a new blank project.

    The only thing I can come up with, is that I started this projected using the "Platformer" template, and something inside of there is causing this, and when I do it on a "Blank" project template, it works fine.

  • The problem here is that the state is "idle" for 1.25 seconds before it changes to "stop" and for every tick during those 1.25 seconds you are running those actions.

    So it's like:

    Tick 1: Set speed, wait 1 second, set movement enabled, wait 0.25 seconds, set movement disabled

    Tick 2: Set speed, wait 1 second, set movement enabled, wait 0.25 seconds, set movement disabled

    Tick 3: Set speed, wait 1 second, set movement enabled, wait 0.25 seconds, set movement disabled

    Tick 4: Set speed, wait 1 second, set movement enabled, wait 0.25 seconds, set movement disabled

    etc...

    1.25 seconds after the first tick where state was "idle", it will set the movement disabled and the state to "stop", but you still have 1.25 seconds worth of events queued up that will set it to enabled again. The movement is going to be set enabled - disabled - enabled - disabled until all those queued up actions finish running and you get that extra movement that you see.

    What you want is to only run this block of events once when the state becomes "idle" which you can do using "System: Trigger once".

    Here's a capx that highlights the problem:

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)