Sprites 'sliding' against tiled background.

  • Here's the capx showing my issue ... Capx

    I have a tiled background, 256x256, which I'm positioning relative to the player's 'map' location (the player is held steady in the exact centre of the screen and everything revolves around him). So to find the location of the tiled background, I use a 'mod 256' calculation.

    Then to find the location of enemy ships (which are also placed relative to the player at the centre of the screen), I just need the relative placement, e.g Enemy.X = Player.X + (Enemy.MapX-Player.MapX).

    As pointed out below, the enemies are the light blue blocks.

    Both calculations are 'correct' (I think) but it leaves a strange effect where the enemies 'slide' against the background. I'm guessing this is because the enemy positions aren't integers and the tiled background is set to exact integers because of the mod function.

    Any ideas on how to correct this? Is there a way I could position the scrolling background more accurately without using mod?

  • Enemies don't seem to spawn at all in your .capx, could you add them back in so we can see the problem?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • My bad, should have pointed out that the light blue blocks are the enemies. I just haven't put a graphic in yet. The blocks do make the effect very obvious.

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