A few odd issues

This forum is currently in read-only mode.
  • Well, I'm trying to like Construct. But I keep getting fiddly little issues.

    Maybe you all can help me out.

    I want to create the following:

    A sprite (25x25) in the center of a HUD that is the size of the window (375x400). The player moves with 4-way grid movement around a large map (1200x1200) with a tiled background.

    The irregular size of the window is because it needs to have a centered square (with a double-square-width space for the HUD at the top).

    I placed all the above, and set it up so the map would scroll around the player as he moved and the HUD would remain in place, taking up the whole window. My intention was to make it so the player only appears to move if he hits the edge of the map, but otherwise remains in the center of the HUD at all times, for a little grid-based RPG kind of thing.

    Unfortunately, that's not what happens.

    The player moves around the window area no matter what I do, even though the window is centered on him. When he moves, the background does move, but the tiles are blurry and improperly aligned, no matter what I do.

    Might anyone know the cause of this?

    (Another minor issue - the 'show grid' function doesn't seem to properly align with the tiles, but that I can cope with for now.)

  • What size are your background tiles? If they're not power-of-two square then that's likely the problem for the blurriness and misalignment. It's likely your video card.

    Most video cards are optimized to handle textures that are power-of-two squared, and any other size causes these irregularities. This means that for a seamless, repeating texture you will need to use Tiled Backgrounds that are 8x8, 16x16, 32x32, 64x64, 128x128, etc. So if your background tiles are the same 25x25 as your player sprite, then you will run into problems.

    This isn't a Construct issue, it's a hardware issue. Due to how bits work in computational terms, it's industry standard to conform to these because computers can crunch those numbers more efficiently. Some graphics cards though are designed to handle non-standard texture sizes like 25x25, but apparently that's not the case with yours.

    If you redesign your tiles and sprites to conform to power-of-two sizes then you will probably see the results you are looking for. Yeah, it might be odd doing math for them at first because you can't do it in your head as easily as with factors of 5, but you'll get used to it eventually.

    As for the grid shown in the layout editor, you can change the grid size to whatever you want

    Apart from that, I can't quite tell from your post if your player sprite is moving how you intended... something about only appearing to move at the edge of the screen? I don't quite understand what you mean. Perhaps you could post a .cap showing what's going wrong, and explain in greater detail what the effect is that you're looking for.

  • Ah, that would make sense. Resizing go!

    What I'm looking to do is this.

    Player moves in a grid around a play field, but the HUD moves with him so he always appears to be in the center... UNLESS he reaches the bounding at the edge of the field, in which case the view no longer centers on him, so he can move to explore the areas in corners of the field. I'll try to toss a .cap together to see if I can show you what I mean.

  • Ah, that would make sense. Resizing go!

    What I'm looking to do is this.

    Player moves in a grid around a play field, but the HUD moves with him so he always appears to be in the center... UNLESS he reaches the bounding at the edge of the field, in which case the view no longer centers on him, so he can move to explore the areas in corners of the field. I'll try to toss a .cap together to see if I can show you what I mean.

    Hmm, if I'm right in thinking what you're trying to do, it does that automatically. Have you made sure unbound scrolling in the layer properties is switched OFF. Because in that case, I'm 99.9% sure that the player will be centered in the screen until you reach the edge of the playing area, at which point the view will stop at the edge, while the player can continue up to the boundaries.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hmm, if I'm right in thinking what you're trying to do, it does that automatically. Have you made sure unbound scrolling in the layer properties is switched OFF. Because in that case, I'm 99.9% sure that the player will be centered in the screen until you reach the edge of the playing area, at which point the view will stop at the edge, while the player can continue up to the boundaries.

    I believe you have the gist of my idea. And you're right that that is what is supposed to be happening. But it doesn't. I have all the settings set in such a way but my player still moves around the screen and even out of the HUD.

  • > Hmm, if I'm right in thinking what you're trying to do, it does that automatically. Have you made sure unbound scrolling in the layer properties is switched OFF. Because in that case, I'm 99.9% sure that the player will be centered in the screen until you reach the edge of the playing area, at which point the view will stop at the edge, while the player can continue up to the boundaries.

    >

    I believe you have the gist of my idea. And you're right that that is what is supposed to be happening. But it doesn't. I have all the settings set in such a way but my player still moves around the screen and even out of the HUD.

    *

    Try that, it works. The only reason you can move off the screen is there's nothing setup to stop you going off the edge in it, which would be simple enough to do. But it shows the player staying in the center until reaching the edge. I'm guessing you may have accidentally put your player character into the same layer as the UI? Or something along those lines.

  • ...sigh.

    I'm guessing you may have accidentally put your player character into the same layer as the UI?

    Yes, yes I did.

    Anyway, it's all fixed now, and the resizing stopped the trippy background problems.

    Thanks for all the help.

  • and the resizing stopped the trippy background problems.

    Thanks for all the help.

    No prob

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