Tag Info

New answers tagged

0

Put all your frames into 1 image, then load that image into an sf::Texture. In your spritesheet class, have that texture (or a ref to it) as a member along with an array (vector) of sf::IntRect objects, which each represent the parts of the texture that the frames are from. When you want to draw a frame from your spritesheet, create a temporary sf::Sprite ...


0

I solve the second problem. It was in front of me all the time. As I said, I was using this code as example. What this awesome answer doesn't explain you is that once you compile the code, if you select the sprite back on hierchy you'll notice two variables available, corresponding to the one you declare back in the code. My BIG mistake was not ...


0

The path you find with A* and the path a unit travels do not have to be exactly the same path. You can use methods like steering to follow paths found by A*, while avoiding the corners of your obstacles. Or you can change the input to your A* to allow it to find whatever kind of path you like (which can be followed directly). And you can find paths for ...


0

I finally found a satisfying solution! @Thebluefish comment pointed me to the right direction with masks. The idea is to use a shader that draws the character in two passes: In the first pass the character is rendered normally, BUT being completely behind the bushes. In the second pass I draw it again, using a mask that olny draws the top part of the ...


-1

You can detect wether or not character is in the grass. Then draw only top-half of character.


0

There are several ways to achieve this, presumable you are not using Canvas but rather the DOM for your Isometric grid? If so, read on. Method Draw your Images at x10 the highest resolution you display them at, e.g. (1200x1200 for an image being displayed at 120x120). Vector (SVG) would be another choice, but fine detail is an issue for them, and, ...


2

From wikipedia (http://en.wikipedia.org/wiki/Super_Nintendo_Entertainment_System#Game_cartridge) The largest games released (Tales of Phantasia and Star Ocean) contain 48 Mbit of ROM data That's 6MBytes. The smallest tile/sprite you could easily store is a 8x8 1bpp tile, giving you (6*1024*1024/8) 786,432 tiles without any space for code and other ...


0

you can simply use the box2d editor to match your sprite sheet with the body fixture there is a powerful application who do this for you : LINK you can : Automatically decomposes concave shapes into convex polygons, Automatically traces your images if needed, Supports multiple outlines for a single body, Supports polygon and circle shapes, Reference ...


0

If you arent going (or can't because of software limitations) to remove the extra pixels you could go into the original sprite sheet and move the image of the crouching soldier down. The problem is that you won't have accurate collision detection if you are keeping those extra pixels so crouching might be useless.


1

Yes - you can use the Marching Squares algorithm to detect the bounds of the image within the frame, and then I would suggest storing the actual bounds (height/width) somewhere. Particularly if your sprites contain islands, as this can take a long time to locate all the little pieces in the frame. Ideally, you would repack your spritesheets into an atlas so ...


0

If you want to draw the sprite in the exact center, you have to take the sprite's height and width into account. Assuming your viewport's width and height are set equal to the device's width and height. You can set the sprite's position this way sprite.setPosition((viewportWidth - sprite.getWidth())/2 ,(viewportheight - sprite.getheight())/2 );


1

I agree with @Christian (though I wouldn't call it a hack). Detect the condition when the object should look different and then just draw it different. Every single thing in the game doesn't have to be a "model" of how it works in "nature". That's a mistake I've made many times and so it's become something of a mantra for me. Ask yourself this: what ...



Top 50 recent answers are included