Tag Info

New answers tagged

0

Thanks @Ali.S . It just worked for me. Thanks a ton.


0

I highly recommend you look into spritesheets, for memory efficiency/performance. There are a couple of tools out there to help you convert your collection of images into a spritesheet, such as this open source one, or my Gimp plugin for it. A quick google found me this sdl2 tutorial on spritesheets.


1

For loading the images, you could do: std::vector<imagebatch> fotos; std::vector<SDL_Texture*> healerTexture; // Parts of filename string that occur multiple times. char* filenameBase = "DData/towners/healer/healer/Healer"; char* fileExt = ".png"; // This is 15 because of the number of images there are. for (int i = 0; i < 15; ++i) { ...


0

The items spawned want to be objects with intrinsic position properties and a move method that can be called every frame or every set update to change the objects position downwards. As these are instantiated you can set up the y position such that they start just above the viable screen, and use a RandomNumber*screenwidth to determine the random x ...


1

The sf::IntRect that you will use will be the same for both directions. What will need to be changed is the scale of the sf::Sprite variable. You will simply need to do something similar to this: // Assumes that the image side is 24x32 and it is the first frame of the sprite sf::IntRect test(0,0,24,32); playerSprite.setTextureRect(test); if( walkingleft ...


0

If you have a convex shape then what you can do is perform a convex hull operation to get a list of vertices that define the edge. Now find the average position of these points to define the center. If you already have a list of edge vertices then you can ofcourse skip that step. These edge points and the center can be used to define triangles as is common ...


0

From LibGDX's docs: spriteBatch.draw(Texture texture, float x, float y, float width, float height, int srcX, int srcY, int srcWidth, int srcHeight, boolean flipX, boolean flipY) Draws a rectangle with the bottom left corner at x,y having the given width and height in pixels. Set flipX as true to get your desired result


1

Yes, thats called dirty blitting. The Newbie Guide to pygame touches on this. The steps they recommend to implement it are: Blit a piece of the background over the sprite’s current location, erasing it. Append the sprite’s current location rectangle to a list called dirty_rects. Move the sprite. Draw the sprite at it’s new location. Append the sprite’s ...


1

If you are doing a classic 2d platformer (which you [the OP] are not [this answer is directed at people who are doing it]) then you could use something like DragonBones (open source). Even in your situation, you could make some considerations and implement something like this. If you must have the tool look perfect from a lot of angles and can't compromise ...


1

Your shader, vertex structure, and glVertexAttribPointer calls do not agree. This tends to cause unusual behavior because you're mapping unexpected values to the GPU pipeline. Your vertex structure says you have a 3-vector for position, a 2-vector for for texture coordinates, and a 3-vector for the normal (a total of eight floats per vertex). Your ...



Top 50 recent answers are included