Zarhon's Forum Posts

  • 5 posts
  • I'm having trouble figuring out a good way of getting sprites to alter their shape after interactions or triggers, which I need as a game mechanic for a puzzle game.

    For example, I don't know how to make a circle get 'stamped/crushed' into a (smaller or equal-sized) square, or have a sprite generally act like play-dough when it comes to objects pressing into it (squished or pulled into a shape).

    So far, my only idea is to manually make animations for each re-shaping, but that seems too clunky to work with, especially when interacting with other objects (barring tricks like hiding animation/sprites shifts behind other sprites), and doesn't allow for making the 'shaping' into a proper game mechanic.

    Is there a better behavior/physics way of going about this 'morphing' of a sprite than just basic animations?

    EDIT: Another idea I got would be that the morphing sprite treats instances of 'on overlap/on collision' by morphing its shape (not position!) so that it's no longer doing so. This should in theory make is so that it will get 'squished' by an object (until it stops moving), but I'm not sure how to make the actual morphing happen in such a case...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Works like a charm. Thanks!

  • For my grid/tile game, I set up a 'spikes' obstacle/tile that the player can walk onto.

    The player-sprite gets damaged if it moves on that square, receives a short period of 'invulnerable frames', then takes damage again, repeating until dead or it moves off the spikes. Similar to how spikes work in Binding of Isaac.

    The problem is that my 'invulnerability frame' code doesn't prevent damage while the character is flashing, and the spikes only do damage once, making them 'safe' afterwards (until you walk on and off of them). How do I get it to 'repeat' damage whilst colliding/overlapping, without insta-killing the sprite?

  • Hey Zarhon,

    One approach that might work...

    [stuff]

    Thanks for the advice! After fiddling around with the code in the manner suggested, came up with this code as a solution, with the origin point in dead center of the PC-sprite (pics in link):

    http://imgur.com/DLWfx5H,pAgqenl,cKYtUhS,1oy222T#0[/code:w46z9a1c]
    
    Now, the movement is working as intended (spin into desired direction, then move on grid, with WASD), however, now I need a way for the PC-sprite to be 'blocked' by the 'wall' tiles (see picture below), for which I need to 'detect' the wall tile, whilst still being able to go right into the square next to it (or in between).
    [img="http://i.imgur.com/1oy222T.png"]
    
    I'm also a bit unsure what a good methodology would be to apply the same movement to the AI - pathfinding behavior, or a specific re-work of my existing code?
  • I'm having some issues with getting a player-sprite to move/align properly within a checkerboard-style map.

    The player-sprite, which is 60x60px, is within a 60x60px grid, on the background of a checkerboard tilemap, and the player-sprite is supposed to move similar to a chess-piece, but also rotating before moving in a cardinal direction. Think Zelda, but restricted to rotating in place and moving in cardinal directions on a grid.

    My problem is that the player-sprite won't align/snap on the grid-view properly unless I alter it's origin point to be in the top left of the sprite square. This then causes complication when I try to rotate the sprite.

    If I put it in it's default central position, it snaps in between the checkerboard squares of my tilemap which I don't want.

    In addition, I added walls of 60x60 size to serve as 'edges' of the map, but my sprite appears unable to move near them.

    The code I used for the grid movement was copied from one of the other tutorials on the site.

    Long story short:

    • Construct's Grid-view and hand-made checkerboard tilemap grid do not match each other, despite being same size.
    • Player-sprite is having issues with alignment, rotation, and movement on the grid because of above.
    • Sprite also won't move near/between walls for some reason.

    EDIT: Okay, apparently I lack the rep points to link to dropbox, and the forum keeps giving me SQL errors when I try to add an attachment. How do I share my .capx file?

  • 5 posts