A few odd issues

For questions about using Classic.

Post » Tue Dec 01, 2009 4:26 am

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.)
B
2
S
1
G
3
Posts: 43
Reputation: 1,086

Post » Tue Dec 01, 2009 8:42 am

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.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Tue Dec 01, 2009 2:20 pm

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.
B
2
S
1
G
3
Posts: 43
Reputation: 1,086

Post » Tue Dec 01, 2009 2:44 pm

[quote="GoldMatenes":sgjeg5ez]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.[/quote:sgjeg5ez]

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.
B
3
S
2
G
3
Posts: 628
Reputation: 2,531

Post » Tue Dec 01, 2009 4:04 pm

[quote="Lost my Keys":39ox9bnu]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.[/quote:39ox9bnu]

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.
B
2
S
1
G
3
Posts: 43
Reputation: 1,086

Post » Tue Dec 01, 2009 5:23 pm

[quote="GoldMatenes":2chzuv5y][quote="Lost my Keys":2chzuv5y]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.[/quote:2chzuv5y]

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.[/quote:2chzuv5y]

*

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.
B
3
S
2
G
3
Posts: 628
Reputation: 2,531

Post » Tue Dec 01, 2009 7:29 pm

...sigh.

[quote="Lost my Keys":1nuz9uye]I'm guessing you may have accidentally put your player character into the same layer as the UI?[/quote:1nuz9uye]

Yes, yes I did. :|

Anyway, it's all fixed now, and the resizing stopped the trippy background problems.
Thanks for all the help.
B
2
S
1
G
3
Posts: 43
Reputation: 1,086

Post » Tue Dec 01, 2009 7:38 pm

[quote="GoldMatenes":3qp8pkb9]and the resizing stopped the trippy background problems.
Thanks for all the help.[/quote:3qp8pkb9]


No prob :)
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest