Image sizes for non-square shapes
Hey there,
I've been trawling the forums and reading help documents regarding image sizes. So far as I've read, it's wise to use 8x8, 16x16, 32x32, 64etc.
In my ignorance I initially decided to make sprites with daft canvas sizes like 12x12 and 24x36. I'm currently updating them to fit the recommended size, plus they're looking much better second time round.
My question is twofold;
if I have an image sized 16x16 but the actual drawing itself only uses 16x8 pixels leaving a letterbox of nothing either side, does that mean the hit box for collisions will still be the whole 16x16.
Secondly, if I create a 16x16 image and later resize it as 8x16 in the attributes, when it comes to compiling for iOS, will these be automatically rescaled to 16x16 in attributes (not actual image dimensions)
TL;DR version
It states in the help that these images are rescaled upon compiling, I'm confused how this impacts my images and areas in them that are invisible. Do they have to be square or can they be rectangular.
Thanks in advance for any replies, apologies for the obscure way I worded my query.
Comments
Edit: see @Socks' answers below.
The easiest way to see the hit box is to import the image into GameSalad, drag it to the Actor Inspector area to create a new actor, and then drag it onto a scene. When you click on the actor on the scene, you will see the outline of the hit box.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I think you might confuse him with that answer - next to his question (quoted in your response) of: "if I have an image sized 16x16 but the actual drawing itself only uses 16x8 pixels . . . does that mean the hit box for collisions will still be the whole 16x16" . . . . you appear to be answering 'no' ?
But of course if the image (and presumably actor) is 16x16 pixels then the 'hit box' will be the whole 16x16 pixels.
I think the forum's quoting brain chopped off the bottom half of his post when you quoted it !?
On a side note, I've decided to answer these questions with: 'you collide with the actor not the image' - I think it clarifies the issue in a straightforward kind of way.
The image sizes don't have to be square.
So you can have 64 x 16 pixels . . . 8 x 64 pixels . . . 4 x 4 pixels . . . . and so on, basically when adhering to the powers of 2 rule (2, 4, 8, 16, 32, 64, 128 . . . ) the x and y dimensions can be different.
Those values would be absolutely fine, perhaps fractionally less memory efficient than if they stuck to powers of 2 values, but not the kinds of performance/memory gains you'd be able to measure.
Where sticking to powers of 2 values is important is when images get bigger, so for instance a 1040 x 1040 pixel image is too big to be held in a 1024 x 1024 pixels (a power or 2 value) 'container' . . so the next size up container must be used, which is . . . 2048 x 2048, but if you were to shrink (or trim) your image to 1024 x 1024 pixels you would save a fairly hefty 75% of the memory usage for the image, as well as only asking the devices processor to throw a 1024 x 1024 pixel image around the screen rather than a 2048 x 2048 pixel image.
You might, at this stage, want to differentiate between an image and an actor, otherwise your questions (and your interpretation of the answers given) might start to get a little confused.
In the attributes you are resizing the actor rather than an image.
I'm not too sure what that means ? Is the question 'if I change the size of an actor, will it change back to the size I changed it from - when compiling for iOS' ?
Sounds like a terrifying idea !
iPad example:
You work at 1024 x 768 pixels.
The actual iPad (Retina) is 2048 x 1536 pixels.
So, you have an actor in your game, it is 512 x 768 pixels, it takes up the entire lefthand side of your scene . . . when the same actor is shown on the iPad it will still take up the same space, the entire lefthand side of your scene, but it will be made up from 1024 x 1536 pixels.
And in the centre of this 512 x 768 pixel actor you have another 100 x 100 pixel actor, it too - when shown on the iPad - will be the same size, but have 'twice' as many pixels crammed into it . . . so in your project, when you make a 100 x 100 actor, it's best to produce the artwork on a 200 x 200 pixel canvas, so when the 100 x 100 actor (with the 200 x 200 pixel image) is on the iPad screen it's using up all those lovely pixels.
Oh sorry, I did get confused. Thanks, @Socks.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Thank you both very much for your replies. I do apologise for my unclear questioning, still very new to this and not best at articulating what I'm trying to comprehend myself.
However, I feel my queries have been answered. Thank you @socks for the detailed response. I am especially pleased you confirmed I don't need to adhere to squares if using the power of 2 sizes.
I've gone for a pixel art style for a retro feel (perhaps a wee bit like jet pack joyride) but I had figured using small images would keep the efficiency up a bit.
Thanks again