Tag Info

New answers tagged

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 ...


3

I'm not finding any way to do this within the cocos2d framework, so if someone can do that it would probably be a better answer. However, cc.Texture2D does have a getHtmlElementObj() function. Now, this function can return either an image element or a canvas element. If it returns an image, you need to make a canvas from it as shown in this answer: var ...


2

Depending on the texture, if you're changing the texture based on orthogonal connections, you'll only need 5 (if the texture can be rotated) or as many as 15. The simplest solution is to create these textures manually. You'll have a much easier time getting the visuals right. As for deciding which to use, see this question and answer: Choose tile based on ...


1

You aren't suppose to create it with one big sprite. That would consume too much memory for one. While we cannot tell you how it was made in that game, the general idea is using Bézier curves. If you connect multiple curves like these, you can get a smooth flowing surface. You can see an example here on how to create such a smooth surface for your game. To ...



Top 50 recent answers are included