MonoGame sprites not consistently drawing Please don't mark this as a duplicate of my previous question which was asked anonymously. this is a reattempt because i cannot edit the first attempt. What I have so far is randomly generated tile set with items on SOME tiles one creature spawner that spawns up to 5 creatures which can be controlled by the player the ability for creatures to pick up items and bring them back to the spawn and store them for later use What I am noticing is when i launch the game, it doesnt always show all the sprites. Sometimes the spawner is missing, or the creatures, or the GUI. ANd when things DO appear, if i tell the creatures to pick up anything, other items on the ground randomly appear and disappear. even the spawn sometimes disappears! what I do notice is that when i have multiple creatures, some will disappear when crossing invisible lines but not all of them. i forced two creatures to go east at the same speed and time, and one vanished and the other didnt. If you have any ideas as to what might be causing this, please let me know. if you have any questions, i'll try to edit to appease you. thanks for reading! I have my draw method like this GraphicsDevice.Clear(Color.CornflowerBlue) TODO Add your drawing code here spriteBatch.Begin(SpriteSortMode.BackToFront, null, null, null, null, null, camera.GetTransformation()) worldEntity.Draw(spriteBatch) guiManager.DrawGUI(spriteBatch) spriteBatch.End() base.Draw(gameTime) for the world entity... its draw method systematically goes through each tile in the world and calls its draw method. the tile draws itself using Vector2 topLeftOfSprite new Vector2(this.X, this.Y) Color tintColor Color.White spriteBatch.Draw(tileTexture, topLeftOfSprite, tintColor) and then proceeds to call the draw method of any items on it. creatures and items have very similar draw methods. the gui also draws itself in a similar fashion. what i DO notice is that ive NEVER seen ground tiles vanish, only the items on them or creatures in the world. Could it be their Z isn't set appropriately?


how to re use a sprite in cocos2d x some times it takes time to create the sprite structures in the scene, I might need to setup structures inside this sprite to meet requirement, thus I would hope to reuse such structures with the game again and again. I tried that, remove the child from parent, detach it from parent , clean parent with the sprite. but when I try to add the sprite to another scene, it's just wont pass the assertion that the sprite already have parent did I miss some step ? add an example I have a sprite A which involves of quite a few steps to construct, so I used it in scene A layer A, and then I want to use it in scene A layer B, scene B layer A1 etc..... generally speaking I don't want to reconstruct the sprte again.


separate fixed size animation sheet into texture atlas I'd like to separate a 64px x 512px spritesheet into eight 64px 64px images in Adobe photoshop cs 5 so I can use a Texture Packer image atlas rather than a fixed spritesheet. Is this possible? If so, how?


How to avoid the cutoff of a Sprite when overlapping in a terrain? I have a scene where I have a terrain as a PlaneGeometry. And I'm trying to locate a building on it as Sprite. But I'm not able to put that building sprite centered on the terrain without getting a cutoff. Make sense because the terrain is cutting the half. But I'm just wondering if there is a technique to solve this problem. I tried to rotate the sprite as a 3D object. But does not have this property. Also tried using a PlaneGeometry with a MeshBasicMaterial, but the result of the Image looks blurry and without transparency.


how to change floor sprite in unreal engine I have started a 2D side scrolling game in Unreal Engine from the menu when you start a new game. The basic environment loads up and it works but I don't know how to change the floor sprites and player sprites. Please Help.


In what size should i design sprites for unity iOS? I am developing a 2D platform game in unity.I have conceptualised the game and have to design the art assets sprites, but the problem is at what resolution or size do i design them? If I target the sprites size to iPad pro (as its has got highest resolution of all iOS device), can the older iPhone 4S handle it? What are the best methods of designing art assets for multiple resolution(with best performance on older devices)?


How to set a static size for an object in GameMaker? I have many sprites with different sizes, and I have an object in which I set those sprites, but this object gets resized by the currently displayed sprite. How can I set a fixed size for the object so that it can no longer change size? Thanks for any help.


How to create custom methods for sprite groups in pygame? I want to use sprite groups in my game using pygame and the default draw isn't enough. I have tried some tutorials but I failed. So, being more specific I want to create custom methods for sprite groups in pygame such as .handle event (this method can exist at all sprites or not).


Alternative Font loaders in Monogame Framework While working on projects of mine, I have been finding that it is a huge pain to switch operating systems just to create a simple spritefont when using Monogame. I saw that the Nuclex Framework can load fonts which are clearer sharper, and they can be used in a Monogame project as well. They load fonts using the FreeType library, which is very multiplatform and is used widely. Is there a fairly simple way to use the FreeType library or another library to render text suitable for use in a Monogame project, as an xnb file?


Common practice when handling sprite animation Let's say I'm using the following sprite as a sample to try LibGDX Animation and TextureRegion. http www.smackjeeves.com images uploaded comics 7 8 78bc6b62fEySW.gif As you can see, the provided image above has different width amp height per image. The width when Zero performs a slash is different when Zero stands. Is it a good practice to create a padding margin for every image so they have similar width amp height. Or should I just have all the sprite cramped like that and try to handle it in the backend? Thanks


Limiting the speed of a dragged sprite in Cocos2dx I am trying to drag a row of sprites using ccTouchesMoved. By that I mean that there is a row of sprites (they are colored squares) lined up next to each other and if I grab one with a touch the rest follow it. If a sprite moves off screen I want to append it to the rest of the sprites in formation. However, if the sprite formation moves too fast it creates a slight gap between it and the appended sprites. How do I go about limiting the speed that I can drag the sprite with ccTouchesMoved? This is the only solution I could think of to my problem. If anyone has another suggestion to prevent this sprite gap from happening I would appreciate it. In ccTouchesBegan I loop through the sprites, mark the one that is touched(used for another part of game), and save the distance between the touch point and every other sprite. touch (CCTouch )(touches gt anyObject()) location touch gt getLocation() for (int i 0 i lt grid gt getGridSizeY() i ) for (int j 0 j lt grid gt getGridSizeX() j ) button grid gt button(i, j) button gt setDistanceX(location.x button gt getPositionX()) button gt setDistanceY(location.y button gt getPositionY()) if (button gt boundingBox().containsPoint(location)) button gt setTouched(true) Then in ccTouchesMoved I loop through all the sprites again and set them to always be the same saved distance from the touch point. touch (CCTouch )(touches gt anyObject()) location touch gt getLocation() for (int i 0 i lt grid gt getGridSizeY() i ) for (int j 0 j lt grid gt getGridSizeX() j ) button grid gt button(i, j) button gt setPositionX(touchLocation.x button gt getDistanceX()) button gt setPositionY(touchLocation.y button gt getDistanceY()) This is the update method code only for a sprite moving off the left side of the screen. No point in writing all the sides until I get one side to work for (int i 0 i lt grid gt getGridSizeY() i ) for (int j 0 j lt grid gt getGridSizeX() j ) button grid gt button(i, j) Replaces button if it goes off left side of grid if (button gt getPositionX() lt grid gt button(0, 0) gt getPositionX() button gt boundingBox().size.height 2) button gt setPositionX(grid gt button(grid gt getGridSizeY() 1, 0) gt getCoord().x button gt boundingBox().size.height 2) button gt setDistanceX(location.x button gt getPositionX())


Why are my geometry shader generated billboards not showing up given the following code? My program is a rain particle system. After processing a list of positions of rain particles, I passed them to the geometry shader for generating a billboard for each position. If I use a simple method to generate the billboard, (it is a rectangle, not really a billboard), it work well and I can see them in the render target. This simple method proves that the input positions for the geometry shader are right. The below HLSL source implement this simple billboard. maxvertexcount(4) void GSMAIN( point GS INPUT input 1 , inout TriangleStream lt PS INPUT gt SpriteStream ) Transform to view space float4 viewposition mul(float4(input 0 .position, 1.0f), WorldViewMatrix) Emit two new triangles for (int i 0 i lt 4 i ) Transform to clip space g positions is an array of four deltal vectors in the form ( scale, scale, 0, 0).. output.position mul(viewposition g positions i , ProjMatrix) output.texcoords g texcoords i output.color color SpriteStream.Append(output) SpriteStream.RestartStrip() But if I changed to create a real billboard, it shows nothing. My method is based the velocity vector of rain drop. The implementation is in below maxvertexcount(4) void GSMAIN( point GS INPUT input 1 , inout TriangleStream lt PS INPUT gt SpriteStream ) PS INPUT output Velocity of raindrop Rate original velocity The billboard will stays along this vector float3 velocityVector input 0 .speed.xyz FrameRate TotalVelocity ViewPosition the position of camera GenRainSpriteVertices(input 0 .position, velocityVector, ViewPosition, pos) for(int i 0 i lt 4 i ) output.position mul(float4(pos i , 1.0f), WorldViewProjMatrix) output.texcoords g texcoords 0 output.color color SpriteStream.Append(output) The function generating billboard from 1. Point Position 2. Eye Position 3. Velocity vector void GenRainSpriteVertices(float3 worldPos, float3 velVec, float3 eyePos, out float3 outPos 4 ) float height g SpriteSize 2.0 float width height 10.0 velVec normalize(velVec) float3 eyeVec eyePos worldPos float3 eyeOnVelVecPlane eyePos ((dot(eyeVec, velVec)) velVec) float3 projectedEyeVec eyeOnVelVecPlane worldPos float3 sideVec normalize(cross(projectedEyeVec, velVec)) outPos 0 worldPos (sideVec 0.5 width) outPos 1 outPos 0 (sideVec width) outPos 2 outPos 0 (velVec height) outPos 3 outPos 2 (sideVec width) I tried to use Nsight and Graphics Diagnostics in VS2012 to debug, and all of them show that the geometry shader generated the right vertices. The following pictures are from Visual Studio and Nsight, which present the result after the geometry shader finished its job. And the next result is from Nsight For some reason, the generated vertices in the geometry shader are discarded in the pixel shader. Why might this be?


Technical Design Document and PNG filesizes I am writing a Technical Design Document and starting to list assets and their file sizes. The formula for calculating the file size of a PNG is easy width x height x bit depth. I am having a problem with the file size windows shows in the file properties for some of my png's. Background image The dimensions are 1280 x 720 32bit and filesize ought to be 3,686,400B. Windows Properties shows 3.6KB. Shouldn't this be 3600KB? Now I have a cursor image 32 x 32 32bit ought to be 4,096B. Why does the file properties in windows say the file size is 304B? As you can see the size on disk is correct for the cursor but the size is off. With the background image the size is correct but the size on disk is bigger. I am using GIMP to create the images and exporting with none of the tick boxes checked, so no comments or background colour saved etc. Can anyone explain why windows does this? Thank you.


How to determine the best approximate direction I want to determine which sprite to use when one agent is "facing" another agent. My game is 2d, and uses 8 directional movement. Deciding which sprite to use for movement is easy enough since there are only 8 options when moving form one square to another. def direction(self, start, end) method for determining facing direction s width int(start 0 ) s height int(start 1 ) e width int(end 0 ) e height int(end 1 ) check directions if s height lt e height and s width e width return 'down' elif s height lt e height and s width gt e width return 'downright' elif s height e height and s width gt e width return 'left' elif s height gt e height and s width gt e width return 'upleft' elif s height gt e height and s width e width return 'up' elif s height gt e height and s width lt e width return 'upright' elif s height e height and s width lt e width return 'right' elif s height lt e height and s width lt e width return 'downleft' It's verbose, but gets the job done. start is the agents current coordinate position, and as you might guess end is the next step in the list of waypoints which makes up an agents path. The problem is that using the same function for determining which sprite should be used when attacking another agent does not look very good at all. For example, if the target is down, but only one pixel to the right, we would want to show the 'down' sprite, but this function returns 'downright' instead. How can we change it to appropriately return the fitting sprite?


Use spritesheet frames as particles? I want to use frames from a spritesheet as particles for my emitter. I load my spritesheet with game.load.spritesheet('particles sheet', 'http stuff.lck.io luckyslot sprite sheet.png', 50, 50, 6) var emitter game.add.emitter(game.world.centerX, canvas height, 80) And i need some code to load the right frame at random emitter.makeParticles('particles sheet') Any idea?


How to split sprites into multiple pieces, like in image below Or how it should be called? I will change color programmatically. Sorry for my English.


Making Bigger Touch Space in Node Using SpriteKit And Objective C I am trying to make simple game, but I have a problem. The node is too small. On iPhones with smaller screen size, the finger can't move it. On iPad and on simulator, however, the node can be moved due to larger sizes of the screens. Due to that, I know it's not the code that causes the issue. Due to the fact that I am using this paddle image on many levels, I create it as separate file so I can implement it anywhere I want within the app. Here is what I got PaddleNode.m (id)init return self initWithName "paddle" (id)initWithName (NSString )name self super init if (self) self PaddleNode spriteNodeWithImageNamed "board.png" self.userInteractionEnabled YES self.name name self.physicsBody SKPhysicsBody bodyWithRectangleOfSize self.frame.size self.physicsBody.dynamic NO self.physicsBody.usesPreciseCollisionDetection YES self.physicsBody.categoryBitMask paddleCategory self.physicsBody.collisionBitMask emptyCategory self.currentTouchValue nil return self (void)touchesBegan (NSSet )touches withEvent (UIEvent )event self.previousTouchesTimestamp event.timestamp for (UITouch touch in touches) self.currentTouchValue NSValue valueWithNonretainedObject touch (void)touchesEnded (NSSet )touches withEvent (UIEvent )event self.currentTouchValue nil (void)touchesMoved (NSSet )touches withEvent (UIEvent )event for (UITouch touch in touches) NSValue key NSValue valueWithNonretainedObject touch if ( key isEqualToValue self.currentTouchValue ) CGPoint touchPoint touch locationInNode self.scene CGPoint movePoint CGPointMake(self.position.x, touchPoint.y) if ( self withinParentFrame movePoint ) self.position movePoint (BOOL)withinParentFrame (CGPoint)point CGFloat offset self.size.height 2 if (point.y gt offset amp amp point.y lt self.scene.frame.size.height offset) return YES else return NO P.S. I am learning Objective C by myself and English is not my first language. So, if it's OK, explain me like you would to little child.


Displaying sprites in a 2.5D raycasting engine I'm developing a raycasting engine like the one used in DOOM, Wolfenstein 3D, etc. My engine is capable of correctly displaying walls and textures on walls, but I'm stuck at sprites rendering. Given that my engine is based on lines and angles only (just trigonometry), is there a way to render sprites without going for matrices? And if so, which technique should I use?


In AGK2 Basic, how would I attach a camera to the player charater? I've started making a game in AppGameKit and I'm using Tier 1 AGK2 Basic. I'm trying to make a sort of endless runner. I've made it so that the player stays still and the rest of the world moves around them to create the illusion that the player is what is running forward. I then use a global variable to control all movement relative to the player. There must be a better way to do this, though. Like if I were to attach a camera to my player character. How would I do something like that?


Sprite Animation of Tank Turning how many items in sheet I have a question about this tank you can see below. It's from a game called Command and Conquer from the 90s. My question is, how is something like this animated as the tank is turning? Did the game designers draw the tank at a basic position and then draw it again 1 degree and then draw again 2 degrees, etc. until they get all the way around? http cnc.wikia.com wiki Mammoth tank (Tiberian Dawn)?file CNCTD Mammoth Tank Ingame.png


How to handle 2d avatar creation I am new to game design and i am creating a MMORPG that allows players to create 2d avatars that can be customized. If i had lets say a male character model (no equipment no armor). How would i handle body variation for this male model? If this has been answered please provide link. I know layering customizing for equipment and armor has but not morphing the character sprite itself.


Finding relative x and y value on a sprite Gamemaker I'm having a little conundrum that may just result from a lack of knowledge of Gamemaker's functionality. I've attached two images to aid explanation. I have a sprite of a turret (with a gun barrel), attached to a turret object, and at certain points in gameplay this object will spawn another object on top of it (let's call it the 'bullet object'). I would like the bullet object to spawn at the x and y coordinates at the end of the gun barrel. This would be easy to find as a pair of coordinates if the sprite was always stationary, in this configuration. Alas, it is not. It rotates like billy oh. This means that the x and y coordinates at the end of the gun barrel are constantly different. How do I find this constantly changing x and y coordinate? I imagine (though am most likely wrong) that there the initial x and y coordinates of the sprite are saved and can be found even if rotated is there a function that does this? Or do I need to write a script and then call it every time I want to spawn the bullet object? Thanks for your help.


Tiled map editor and objects Ive been searching for an easy way to group multiple sprites of a spritesheet into a single entity. Im using tiled editor as written at the title. Some objects might be larger than the tile size and i need a way to let my game know that in order to manipulate these objects. I dont want to create new tilesets with different sizes for all objects. Is this possible in this app and if not do you know another that can handle this?


How to define axis of Sprites in a CCAnimation? I'm struggling to find how to define a kind of axis in my frames, when my sprite punches it moves back. I want to define the head as a pivot for the other sprites with different sizes. How can I accomplish that?


The right way to add images to Monogame Windows I'm starting out with MonoGame. For now, I'm only targeting Windows (desktop not Windows 8 specifically). I've used a couple of XNA products in the past (raw XNA, FlatRedBall, SilverSprite), so I may have a misunderstanding about how I should add images to my content. How do I add images to my project? Currently, I created a new Monogame project, added a folder called "Content," and added images under there the only caveat is that I need to set the Copy to Output Directory action to one of the Copy ones. It seems strange, because my "raw" XNA project just last week had a Content project in it (XNA Framework Content Pipeline, according to VS2010), which compiled my images to XNB (I think). It seems like Monogame doesn't use the same content pipeline, but I'm not sure. Edit My question is not about "how do I get the XNA content pipeline to work with Monogame." My question is "why would I want to use the XNA content pipeline in Monogame?" Because there are (at least) two solutions (that I see today) Add the images to the Monogame project and set the Copy to Output Directory options to copy. Add a XNA content pipeline project and add my images to that instead reference it from my MOnogame project. Which solution should I use, and why? I currently have a working version with the first option.


Spriter model not touching ground in? I was attempting to make a game in Construct 2 by using my Spriter Models plugin. However, when I imported the model, rescaled it amp changed a few things, I got this As seen in the picture, the Spriter model is not touching the platform ground. Do you know of any ways I could have the model touch the ground? Thanks in advance, Jamie Ps. Here is the link to the files, just in case you guys might wanna have a look at it https drive.google.com folderview?id 0B11opD9YgSqWbVhaNEVTcGhIRTA amp usp sharing Pps. You will need the Spriter plugin for Construct 2 to open the project file. The Spriter model files will need Spriter to open it.


Pygame Increase and decrease the image size I'm creating a 2D game where the player shoots cannon balls.. To give the impression of movement, i want the cannon ball to increase size untill half of the path, and then decrease untill it reach the target (just like rampart game cannon balls). right now im doing this in every draw, but the call doesnt increases self.CannonImg pygame.transform.smoothscale(self.CannonImg, (10 int(auxDistance 10), 10 int(auxDistance 10))) http i.gyazo.com d88a0ef419bd1014eaa180144fa876bf.png This is how the images shows up. But it doesnt scales smoothly, and the image is cut on the edges (with time, it starts to look a little bit transparent). Is there any easy way to do it? Also, i'm using images as the following. Though i've been reading, and found some people using sprites. What should I do? self.CannonImg pygame.image.load('Imagens CannonBall.png') self.surface.blit(self.CannonImg, self.Position) Thanks!


MonoGame sprites not consistently drawing Please don't mark this as a duplicate of my previous question which was asked anonymously. this is a reattempt because i cannot edit the first attempt. What I have so far is randomly generated tile set with items on SOME tiles one creature spawner that spawns up to 5 creatures which can be controlled by the player the ability for creatures to pick up items and bring them back to the spawn and store them for later use What I am noticing is when i launch the game, it doesnt always show all the sprites. Sometimes the spawner is missing, or the creatures, or the GUI. ANd when things DO appear, if i tell the creatures to pick up anything, other items on the ground randomly appear and disappear. even the spawn sometimes disappears! what I do notice is that when i have multiple creatures, some will disappear when crossing invisible lines but not all of them. i forced two creatures to go east at the same speed and time, and one vanished and the other didnt. If you have any ideas as to what might be causing this, please let me know. if you have any questions, i'll try to edit to appease you. thanks for reading! I have my draw method like this GraphicsDevice.Clear(Color.CornflowerBlue) TODO Add your drawing code here spriteBatch.Begin(SpriteSortMode.BackToFront, null, null, null, null, null, camera.GetTransformation()) worldEntity.Draw(spriteBatch) guiManager.DrawGUI(spriteBatch) spriteBatch.End() base.Draw(gameTime) for the world entity... its draw method systematically goes through each tile in the world and calls its draw method. the tile draws itself using Vector2 topLeftOfSprite new Vector2(this.X, this.Y) Color tintColor Color.White spriteBatch.Draw(tileTexture, topLeftOfSprite, tintColor) and then proceeds to call the draw method of any items on it. creatures and items have very similar draw methods. the gui also draws itself in a similar fashion. what i DO notice is that ive NEVER seen ground tiles vanish, only the items on them or creatures in the world. Could it be their Z isn't set appropriately?


How player(sprite) in the phaser will opposite or reverse while going left and right? I am developing a game where my player has to look to see forward when I am pressing right arrow key. But how can I make it look reverse after pressing left arrow? I can create a sprite of reverse look but how can load that while pressing left and at the same time forward player should be destroyed?


What is the purpose for drawing vertices and shapes in OpenGL (or DX), if a game is using sprites? Something I do not understand. All the tutorials on OpenGL, DirectX, or other, always show you how to draw a shape and then change its vertices, move it around and so on. But all the games I know of, tutorials on creating, etc., always have sprites and sprites alone. What is the reason for drawing triangles and squares for games? I never see it used, only pre made graphics. edit based upon answers so far, is the purpose of drawing shapes to "bound" a sprite? So if I have a character, on a platformer like Mario, Mario has a shape around him and that shape's location is used to detect collisions, etc.? edit Maybe a small example?


When to use pygame.sprite.GroupSingle? I'm doing a game in which i have a ball which is controlled by the keyboard and the goal is to get is out of a maze without touching the walls. I've added my ball sprite to GroupSprite vehicle pygame.sprite.GroupSingle(Vehicle(70,470)) since at the time, i thought that was the right way of doing it. However, i found that all the interaction always goes with the sprite directlly not with the GroupSingle. So I end with constantly accessing the sprite throug the GroupSingle.sprite vehicle.sprite.desired speed up down Is there a reason why i shouldn't just remove 'GroupSingle' and define vehicle Vehicle(70,470)


How can I flip a sprite in SFML? I am facing the same problem although the sprite flips but only one time after that it does not flips at all. Here is the code snippet void Doodle moveLeft() if(d Right) d Sprite.setScale( 1.0f, 1.0f) d Left true void Doodle moveRight() if(d Left false) d Sprite.setScale( 1.0f, 1.0f) d Right true void Doodle stopLeft() d Left false void Doodle stopRight() d Right false


Why are 16 16 pixel tiles so common? Is there any good reason for tiles (e.g. Minecraft's) to be 16 16? I have a feeling it has something to do with binary because 16 is 10000 in binary, but that might be a coincidence. I want to know is because I want to make a game with terrain generation, and I want to know how big my tiles should be, or if it doesn't really matter.


How to determine the best approximate direction I want to determine which sprite to use when one agent is "facing" another agent. My game is 2d, and uses 8 directional movement. Deciding which sprite to use for movement is easy enough since there are only 8 options when moving form one square to another. def direction(self, start, end) method for determining facing direction s width int(start 0 ) s height int(start 1 ) e width int(end 0 ) e height int(end 1 ) check directions if s height lt e height and s width e width return 'down' elif s height lt e height and s width gt e width return 'downright' elif s height e height and s width gt e width return 'left' elif s height gt e height and s width gt e width return 'upleft' elif s height gt e height and s width e width return 'up' elif s height gt e height and s width lt e width return 'upright' elif s height e height and s width lt e width return 'right' elif s height lt e height and s width lt e width return 'downleft' It's verbose, but gets the job done. start is the agents current coordinate position, and as you might guess end is the next step in the list of waypoints which makes up an agents path. The problem is that using the same function for determining which sprite should be used when attacking another agent does not look very good at all. For example, if the target is down, but only one pixel to the right, we would want to show the 'down' sprite, but this function returns 'downright' instead. How can we change it to appropriately return the fitting sprite?


Getting sprites to move exactly the same on different devices Background When moving a sprite along the X axis, this is my code spriteXReal spriteXReal (spriteXVel dt) .5 would be halfway point of, 1 would be right hand side screen etc... spriteXScreen spriteXReal deviceWidth And the spriteXVel value above is worked out as spriteXVel 1 spriteXTime So I would set spriteXTime to 10 if I wanted my sprite to work it's way across the screen in 10 seconds. My code Uses a fixed delta time Has tics per second capped at 60 (so my delta is 1 60) The issue This is great and works well, however, I am getting odd results when running on a different device (with a different screen res). When comparing the 2 devices (simply by starting the game on both devices at the exact same time, they are almost identical save for a tiny difference in speed. The game world is tile based. Let's say the play area on my development device is 16 tiles wide. 16 tiles fit perfectly onto this device So, if I'm moving between 8 tiles, I'm effectively crossing 1 2 of the screen. Initially, the sprite appears to move the same on both devices, (going back and forth between say the 1st 'proper' tile and the 8th 'proper' tile), but after about 25 seconds, they are clearly out of sync. On this device, the tiles would look something like this So, I'm working out my sprite movement using the device's width as above. However, if the tiles don't fit exactly, I'm centering the original tiles and adding 'padding' tiles to the play area like so Therefore, my confusion lies in how I should be working out my sprite's new position. because, now 8 tiles is actually less than 1 2 of the device's screen. So should I still be using the code above or something like this spriteXScreen spriteXReal (Block18X Block2X) I have actually tried both and when I did, the problem was still evident, so I'm not sure which one I'm supposed to be using. What is really odd is that when I set my sprite's Time variable to certain amounts, it appears that everything stays in perfect sync between these 2 devices so I'm completely stumped that's what I've observed thus far anyway. I'm going to test that theory a bit more. What else could be causing this discrepancy?! Really appreciate some help with this one! Edit I've pretty much tried everything I can, I've even tried implementing a very simple 'test' game loop that updates sprite positions once every second, and put the two devices side by side, however, the Samsung Galaxy Ace Always runs ahead of the Google tablet, is it possible that System.CurrentTimeMillis() is actually running faster on the Ace than on the tablet?


Pixel perfect 3D sprite picking on cylidrical billboarded sprites? Background Info I have an OpenGL app where a player (just an AABB with an eye height, look and move vectors), can walk along a 3D grid made of a square cells, essentially like a player walking along a Minecraft level. The cells can also have differing heights, which qualifies it as a 3D level, rather than 2D. On each cell, there is potential to be a static sprite, which is centered on that cell. The sprite is rendered as a "cylindrical billboard" so that it's always facing the camera, but the base bottom of the sprite is always rooted in the ground. Like this https www.youtube.com watch?v 2 queKkSVnw (The point I'm making is that these cylindrical billboarded sprites render a bit differently than standard sprites which would be coplanar to the view plane on the vertical axis, as well) Here's a simple representation, where the green stick is the player, and the pink squares are the billboarded sprites which are centered on their cells. (Note normally, the camera view would be from the player's eyes, and thus all the pink sprites should be aligned with the player's view plane) I also have an "arm reach" vector which is a line segment that extends outward from the crosshair a certain distance, in other words a line segment. This line segment is slightly less than the width of one cell. So, worst case scenario, then, is that this line segment is intersecting with three cells at once, like this Question My question is how should I detect that the user's arm reach ray segment is intersecting with a vertically billboarded sprite, knowing that the sprites may have transparent pixels? I know that the first step would be to find which cells the ray segment is overlapping, as shown in the previous pic as the green highlighted cells. The next step (in my case) shall be a 3D distance check from the player to the sprite location. If too far, can't click it, no matter how you rotate the camera view (and distort the sprite). After that, I'm unsure. I assume I need to somehow first check if the ray is intersecting the billboarded sprite's "rectangle" (the pink rectangle) (I say rectangle in quotes because it will be a distorted rectangle in first person view, due to perspective angle), and then pixel pick on the sprite and look for the transparent color, but I'm not sure how to do either of those steps. Daggerfall somehow accomplished this. Interacting with a billboarded sprite (i.e. a treasure pile) requires you to actually click on a non transparent pixel of that sprite, or the click doesn't count. Any sources on related techniques would be greatly appreciated. Thank you for your time!


Bouncing projectile off of sprite, the sides work but top and bottom do not I'm having a problem bouncing a projectile off a sprite, we've been asked to move the projectile using the equations of motions which makes things a little more difficult but as far as I can see what I have should work. What I'm trying to do is change the angle of the collided projectile depending on which direction it is coming from. Here is a video that is hopefully not too laggy for you to see what is happening Link When the projectile collides with the left or right hand side of the sprite everything works as expected, it just switches X direction. When it hit's the top or bottom of the sprite however it doesn't change, it just sort of rolls along the top and the shoots off. Here is the movement code float nX get x() cos(nGetAngle() 3.14 180) getU() getT() float nY get y() sin(nGetAngle() 3.14 180) getU() getT() 0.5 9.8 getT() getT() set world position(nX, nY) Where U is initial velocity, T is time and nGetAngle() is the angle in degrees (which is set to radians whenever the angle is set). Here is my collision for the top of the player if the projectile is colliding in any way with the player sprite if (projectiles currProj gt get y() lt player gt get y()) top of player float vx cos(projectiles currProj gt nGetAngle()) float vy sin(projectiles currProj gt nGetAngle()) float newAngle atan2( vy, vx) 180 3.14 projectiles currProj gt nSetAngle(newAngle) projectiles currProj gt set world position y(player gt get y() projectiles currProj gt get height() 1) and here is my collision for the left of the player else if (projectiles currProj gt get x() lt player gt get x()) left of player projectiles currProj gt set world position x(player gt get x() projectiles currProj gt get width()) float vx cos(projectiles currProj gt nGetAngle()) float vy sin(projectiles currProj gt nGetAngle()) float newAngle atan2(vy, vx) 180 3.14 projectiles currProj gt nSetAngle(newAngle) The left side collision works, the top does not and I have no idea why. If necessary I can post the entire project somewhere.


Quarter turn sprite sheets? I'm having trouble finding sprite sheets that have the characters turn in 8th movements, so that you can see back, front, left, right, and in between. What would be a good term to search for when trying to find these kind of sprite sheets?


Letting the user draw a Polygon Body and Image In my game, I want to provide the user with a drawing feature. By free hand drawing, the user creates a polygon shape. Then, in my game implementation, I have to create a body for the found vertices and generate an image based on that polygon shape. My problem is how to create an image that matches the user provided vertices. I've heard that cocos2d has something called Image Masking. I don't understand how I could implement it in AndEngine. Could someone help?


how to re use a sprite in cocos2d x some times it takes time to create the sprite structures in the scene, I might need to setup structures inside this sprite to meet requirement, thus I would hope to reuse such structures with the game again and again. I tried that, remove the child from parent, detach it from parent , clean parent with the sprite. but when I try to add the sprite to another scene, it's just wont pass the assertion that the sprite already have parent did I miss some step ? add an example I have a sprite A which involves of quite a few steps to construct, so I used it in scene A layer A, and then I want to use it in scene A layer B, scene B layer A1 etc..... generally speaking I don't want to reconstruct the sprte again.


Fill with Transparency in Built In Sprite Editor When I imported an image for a sprite, I realized it had a white background. I went into the built in sprite editor to remove it. I tried using fill as there was a transparent color in the color selector. It did not work. Is there a way to do this, or an easier way than erasing it all by hand?


Make a laser beam effect with Ogre and a BillboardChain http www.lpi.usra.edu lunar missions apollo apollo 15 images laser beam lg.gif I want to be able to such an effect, but I don't really know how the BillboardChain class works or how I can use it, examples for this class seems to be rare.


How can I remove a sprite from the screen using pygame? I am having trouble with removing sprites on my screen using pygame. I am killing my sprite with sword.kill which is removing it from an all sprites group, so it should disappear right? Here is where i blit my images def draw(self) for sprite in self.all sprites self.screen.blit(sprite.image, self.camera.apply(sprite)) pg.display.update() Here is my sword class class Sword(pg.sprite.Sprite) def init (self, game, x, y, entity) self.groups game.all sprites pg.sprite.Sprite. init (self, self.groups) self.game game self.image self.game.sword self.image pg.transform.scale(self.image, (TILESIZE, TILESIZE)) self.image.set colorkey(WHITE) self.rect self.image.get rect() self.x x self.y y self.rect.x x self.rect.y y if entity.direction 'down' self.image pg.transform.rotate(self.image, 90) def update(self) self.kill() And here is where I create my sword object def get keys(self) self.vx, self.vy 0, 0 keys pg.key.get pressed() if keys pg.K LEFT or keys pg.K a self.game.walk sound.play( 1) now pg.time.get ticks() self.vx 200 self.direction 'left' if now self.last update gt self.frame rate self.last update now try self.game.player img self.game.walkleft self.frame self.frame 1 except IndexError self.frame 0 self.swing False elif keys pg.K RIGHT or keys pg.K d self.game.walk sound.play( 1) now pg.time.get ticks() self.vx 200 self.direction 'right' if now self.last update gt self.frame rate self.last update now try self.game.player img self.game.walkright self.frame self.frame 1 except IndexError self.frame 0 self.swing False elif keys pg.K UP or keys pg.K w self.game.walk sound.play( 1) now pg.time.get ticks() self.vy 200 self.direction 'up' if now self.last update gt self.frame rate self.last update now try self.game.player img self.game.walkup self.frame self.frame 1 except IndexError self.frame 0 self.swing False elif keys pg.K DOWN or keys pg.K s self.game.walk sound.play( 1) now pg.time.get ticks() self.direction 'down' self.vy 200 if now self.last update gt self.frame rate self.last update now try self.game.player img self.game.walkdown self.frame self.frame 1 except IndexError self.frame 0 self.swing False elif keys pg.K SPACE self.attack True if self.direction 'down' print(self.rect.centery) self.sword Sword(self.game, self.rect.centerx 7, self.rect.bottom, self) elif self.vx ! 0 and self.vy ! 0 self.vx 0.7071 self.vy 0.7071 self.swing False elif keys pg.K t self.x 1 TILESIZE self.y 1 TILESIZE self.swing False elif self.attack and not keys pg.K SPACE self.sword.update() self.attack False Any help would be appreciated. Thanks!


Editing sprite shading to change perspective? I'm currently developing an RPG in Java with some of my friends, and one of my tasks is to do the pixel art. I'm a beginner at it, but I know that I'll get better in time. I recently finished the concept of our main character (after many, many revisions), however, because the game is going to be in a 3 4 top down perspective how would I edit the shading of the sprite to show this? Obviously a frontal view will not look right. My shading skills are not the best though, even with this sprite (some parts appear to be flat). Below I have the sprite attached. I did read something that said it would be harder to make higher resolution sprites for beginners (tile size is 32 x 32, MC is almost 2 tiles tall) however, it is a difficulty I am willing to deal with. Thanks, Nelson


In what size should i design sprites for unity iOS? I am developing a 2D platform game in unity.I have conceptualised the game and have to design the art assets sprites, but the problem is at what resolution or size do i design them? If I target the sprites size to iPad pro (as its has got highest resolution of all iOS device), can the older iPhone 4S handle it? What are the best methods of designing art assets for multiple resolution(with best performance on older devices)?


How do I make 3d Sprites like Myth did 20 years ago? The game that Bungie cut it's AAA chops on Myth The Fallen Lords. about 20 years old now. https en.wikipedia.org wiki Myth The Fallen Lords For the time, it had a pretty revolutionary way of doing lots of "3d" characters, hundreds, on screen and interactive at a time. to accomplish this, basically they use sprites for each character choosing and skewing each sprite based on the camera perspective to make it appear 3d. I would really love to read and learn more about how this technique worked, as I think it can still be applicable to modern indie games, but I've never seen this technique used since. Does anyone know where I could read more on this? here is a youtube of the game being played, showing the characters https youtu.be PySrgfe6pr4?t 6m2s


Sprite Animation of Tank Turning how many items in sheet I have a question about this tank you can see below. It's from a game called Command and Conquer from the 90s. My question is, how is something like this animated as the tank is turning? Did the game designers draw the tank at a basic position and then draw it again 1 degree and then draw again 2 degrees, etc. until they get all the way around? http cnc.wikia.com wiki Mammoth tank (Tiberian Dawn)?file CNCTD Mammoth Tank Ingame.png


How player(sprite) in the phaser will opposite or reverse while going left and right? I am developing a game where my player has to look to see forward when I am pressing right arrow key. But how can I make it look reverse after pressing left arrow? I can create a sprite of reverse look but how can load that while pressing left and at the same time forward player should be destroyed?


haxe level scrolling How would level scrolling be implemented with haxe and nme? I started plying with haxe and currently the only way to display things on screen is by using nme.display.Sprite. I don't think changing the position of all sprites to scroll the level is the most efficient way of doing things. I can't find any comprehensive example of how this should be done with haxe. Any pointers?


Are metal slug art assets free use? I'm making a mobile game and I've gotten by with completely free art assets so far, but I have an explosion from metal slug. I love it and it's perfect, but I don't want to get sued. I've seen metal slug art assets posted around the internet on various clip art websites, but haven't found any statements outright saying they're free to use in one's own commercial application. Could someone show me a link saying whether or not metal slug assets are free to use?


Alternative Font loaders in Monogame Framework While working on projects of mine, I have been finding that it is a huge pain to switch operating systems just to create a simple spritefont when using Monogame. I saw that the Nuclex Framework can load fonts which are clearer sharper, and they can be used in a Monogame project as well. They load fonts using the FreeType library, which is very multiplatform and is used widely. Is there a fairly simple way to use the FreeType library or another library to render text suitable for use in a Monogame project, as an xnb file?


Collision and response between sprites? What is an easy way to have sprites collide and react to the collision? E.g. if I'm writing a game in XNA or with Canvas 2D and need to write the code myself very simply.


How to rotate an image around its own center in AndEngine? I'm beginner in Android programming with Andengine framework. And my question How to rotate an image around its own center in AndEngine? I use Body and AnimatedSprite. Update This is my code final AnimatedSprite face final Body body face new AnimatedSprite(pX, pY, this.mCircleFaceTextureRegion, this.getVertexBufferObjectManager()) body PhysicsFactory.createCircleBody(this.mPhysicsWorld, face, BodyType.DynamicBody, FIXTURE DEF) face.setUserData(body) face.animate(200) face.applyTorque(100) face.setUserData("monster") this.mScene.registerTouchArea(face) this.mScene.attachChild(face) this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(face, body, true, true)) And here in the ContactListener when have a collision with other object. private ContactListener createContactListener() ContactListener contactListener null contactListener new ContactListener() Override public void beginContact(Contact contact) try Fixture x1 null Fixture x2 null x1 contact.getFixtureA() x2 contact.getFixtureB() if (x2.getBody().getUserData().equals("player") amp amp x1.getBody().getUserData().equals("monster")) x1.getBody().setFixedRotation(true) hitsound.play() mEngine.vibrate(100) Log.i("CONTACT", "BETWEEN PLAYER AND MONSTER!") catch (Exception e) Log.d("ErrorMessage", e.getMessage()) Override public void preSolve(Contact contact, Manifold oldManifold) Override public void postSolve(Contact contact, ContactImpulse impulse) Override public void endContact(Contact contact) return contactListener I have set x1.getBody().setFixedRotation(true) . But position of this object isn't kept. What is wrong with my code?


how to accurately select a sprite on a scene with a click? I have a scene with some sprite on it (added), the gamer has to select one of them and take the next action. What is the simplest way to select one of the sprites accurately? I am looking for a method that recieves a click coordinate and returns one of the sprites on the scene. Since the sprites cant be well fitted in a bounding box I dont like to use a minimum bounding box approximation. I was thinking of loading the sprites into a matrix and creating a scene matrix that each member belongs to a specified sprite, but it costs a lot( each pixel must be transformed using an affine transformation and it must be recalculated each time one of the sprites move) Can someone show me a better way with a lower cost? P.S I am using Swift and Apple's SpriteKit There is a code for minimum bounding box but I am looking for an accurate method. Inaccurate method if some interested is something like this for touch in touches var location CGPoint (touch as! UITouch).locationInNode(self) for asprite in self.viewIso.children if (asprite.containsPoint(location)) println("Selected (asprite.name as String)") return Thanks Iman


Cocos2d rotating sprite while moving with CCBezierBy I've done my moving actions which consists of sequences of CCBezierBy. However I would like the sprite to rotate by following the direction of the movement (like an airplane). How sould I do this with cocos2d? I've done the following to test this out. CCSprite green CCSprite spriteWithFile "enemy green.png" green setPosition ccp(50, 160) self addChild green ccBezierConfig bezier bezier.controlPoint 1 ccp(100, 200) bezier.controlPoint 2 ccp(400, 200) bezier.endPosition ccp(300,160) green runAction CCAutoBezier actionWithDuration 4.0 bezier bezier In my subclass interface CCAutoBezier CCBezierBy end implementation CCAutoBezier (id)init self super init if (self) Initialization code here. return self (void) update (ccTime) t CGPoint oldpos self.target position super update t CGPoint newpos self.target position float angle atan2(newpos.y oldpos.y, newpos.x oldpos.x) self.target setRotation angle end However it rotating, but not following the path...


Creating a border on a tile? I'm using Godot and I want to set an outline on the tile which is currently being hovered over, but I'm not sure whether to do it as a seperate tilemap which is hidden until it is hovered over or just display a highlighted tile sprite when the tile is hovered. This is an example of how I sorta want it. Any advice?


Use an external sprite or image file in flixel game in flashbuilder Is there any way to use an external image sprite file for the graphic of a FlxSprite instance? Say I declare my player FlxSprite as follows player new FlxSprite(FlxG.width 2 5) player.makeGraphic(10,12,0xffaa1111) How could I instead instantiate the FlxSprite using my own spritesheet or image? I have seen others do it in the Flixel demos , and in the featured games.


Where to hire 2D sprite artists? I'm looking for high quality original 2D sprite collections which are animated where appropriate. (IE not simply collections I can buy, we want original work). I've had a look online but am struggling to find out where I can hire such people! Where do I find such people? How much should I expect to pay?


How to make an object with its own sprite draw an additional sprite on top of itself I'm making character select buttons for a Game Maker Studio 2 game, hoping to do so by just having a single object I can edit on an individual basis to change which character it represents. I also want the button itself to display the sprite of the character it's meant to represent like an image overlaying the button's own sprite. I can't seem to get a clear, direct answer on how this is done. To sum up Character select button is an object with its own assigned sprite. Each individual button object holds (a reference to) a corresponding character object the player may select by clicking that specific button. Button object should be able to check the sprite of the character object it references, and draw it on top of its own sprite without replacing it entirely. If anyone can help show me how to do that last part or barring that, perhaps point me toward a better way to achieve a similar effect, it would be appreciated.


Bouncing projectile off of sprite, the sides work but top and bottom do not I'm having a problem bouncing a projectile off a sprite, we've been asked to move the projectile using the equations of motions which makes things a little more difficult but as far as I can see what I have should work. What I'm trying to do is change the angle of the collided projectile depending on which direction it is coming from. Here is a video that is hopefully not too laggy for you to see what is happening Link When the projectile collides with the left or right hand side of the sprite everything works as expected, it just switches X direction. When it hit's the top or bottom of the sprite however it doesn't change, it just sort of rolls along the top and the shoots off. Here is the movement code float nX get x() cos(nGetAngle() 3.14 180) getU() getT() float nY get y() sin(nGetAngle() 3.14 180) getU() getT() 0.5 9.8 getT() getT() set world position(nX, nY) Where U is initial velocity, T is time and nGetAngle() is the angle in degrees (which is set to radians whenever the angle is set). Here is my collision for the top of the player if the projectile is colliding in any way with the player sprite if (projectiles currProj gt get y() lt player gt get y()) top of player float vx cos(projectiles currProj gt nGetAngle()) float vy sin(projectiles currProj gt nGetAngle()) float newAngle atan2( vy, vx) 180 3.14 projectiles currProj gt nSetAngle(newAngle) projectiles currProj gt set world position y(player gt get y() projectiles currProj gt get height() 1) and here is my collision for the left of the player else if (projectiles currProj gt get x() lt player gt get x()) left of player projectiles currProj gt set world position x(player gt get x() projectiles currProj gt get width()) float vx cos(projectiles currProj gt nGetAngle()) float vy sin(projectiles currProj gt nGetAngle()) float newAngle atan2(vy, vx) 180 3.14 projectiles currProj gt nSetAngle(newAngle) The left side collision works, the top does not and I have no idea why. If necessary I can post the entire project somewhere.


Rotate sprite direction Cocos2d I want that my sprite go always forward, and you can only control his direction moving right and left (on 360 degrees). I don't know why, but the movement it's senseless. The constants to move and rotate const int POD DEGRE MOVE 5 const int POD STEP MOVE 3 The sprite initalization dragonSprite gt setPosition(Point(visibleSize.width 2, dragonSprite gt getContentSize().height 0.75)) addChild( dragonSprite, 2) The event key listener void GameScene onKeyPressed(EventKeyboard KeyCode keyCode, Event event) pressedKey keyCode switch ( pressedKey) case EventKeyboard KeyCode KEY LEFT ARROW giro POD DEGRE MOVE isMoving true break case EventKeyboard KeyCode KEY RIGHT ARROW giro POD DEGRE MOVE isMoving true break void GameScene onKeyReleased(EventKeyboard KeyCode keyCode, Event event) if ( pressedKey keyCode) pressedKey EventKeyboard KeyCode KEY NONE isMoving false giro 0 And the calculations of the new direction void GameScene update(float dt) dragonSprite gt setRotation( dragonSprite gt getRotation() giro) podVector Vec2(cos( dragonSprite gt getRotation()) POD STEP MOVE, sin( dragonSprite gt getRotation()) POD STEP MOVE) Vec2 newPos Vec2( dragonSprite gt getPosition().x podVector.x, dragonSprite gt getPosition().y podVector.y) dragonSprite gt setPosition(newPos) Another problem is that the sprite at the start moves to the right (because Cos(0) 1), so I rotate the image of the sprite 90 degrees to the right, to then rotate it again at the initialization 90 to the left so the sprite is in the right position and his start angle is 90 (sin(90) 1), but the angle is not 90, and it moves as he wishes. The last problem I have with this is that when I press a key (right or left), the sprite stops, rotates, and starts again (a direction that is not the direction where the sprite is aiming, that's the main problem). The sprite shouldn't stop while you are moving it. Can anyone help me?


Spriter model not touching ground in? I was attempting to make a game in Construct 2 by using my Spriter Models plugin. However, when I imported the model, rescaled it amp changed a few things, I got this As seen in the picture, the Spriter model is not touching the platform ground. Do you know of any ways I could have the model touch the ground? Thanks in advance, Jamie Ps. Here is the link to the files, just in case you guys might wanna have a look at it https drive.google.com folderview?id 0B11opD9YgSqWbVhaNEVTcGhIRTA amp usp sharing Pps. You will need the Spriter plugin for Construct 2 to open the project file. The Spriter model files will need Spriter to open it.


Moving a sprite over a tile map I am working on a tile based game in Java. I have a 2D array of tiles (JComponents) in a GridLayout, this is fine for creating the world (I think), but I am stumped at how to move the sprite smoothly between tiles. Currently, each JComponent tile draws the world and the sprite in accordance with booleans representing state (i.e. to show the sprite or not to show the sprite), however, this is not smooth. The sprite simply disappears from one tile and appears in another. Any ideas on how I could go about moving the sprite in a smooth manner? I am new to the whole game dev thing, so please be patient. Regards, Jack Hunt


Common practice when handling sprite animation Let's say I'm using the following sprite as a sample to try LibGDX Animation and TextureRegion. http www.smackjeeves.com images uploaded comics 7 8 78bc6b62fEySW.gif As you can see, the provided image above has different width amp height per image. The width when Zero performs a slash is different when Zero stands. Is it a good practice to create a padding margin for every image so they have similar width amp height. Or should I just have all the sprite cramped like that and try to handle it in the backend? Thanks


Where can I find pixel art artist? Possible Duplicate Where can I go to find a game graphic artist? I'm pretty good programmer, and I want to create new pixel art game. I know how to program, visualise and optimize the game. But I can't draw! I think there is a lot of people like me... So.. I'm looking for an artist, who can draw pixel art sprites. Where I can find "free" pixel art artist, who just want to create a game (I think that he should have the similar problem, but instead of looking for artist he looks for programmer).


Using depth buffer on a sprite I am following this guide http www.cocos2d iphone.org wiki doku.php prog guide tiled maps Trying to create a tiled map that also supports multiple layers. The guide says that a way is to use depth buffer, and says to 1) Create the z buffer and a 2D projection 2) For every layer in the tiled map, set the cc vertexz attribute 3) Enable alpha test and set the sprite alpha func. The first question is if I use a tiled maps with multiple layers, are also the point 1 and 3 needed? I am fine with the first two points, but as for the third point I don't know how to do that. I should subclass CCSprite and override the draw method, but the problem is that when I create a tiled map there are already sprites on it, so the instances don't belong to the subclass I created. How I go around this?


Which isometric angles can be mirrored (and otherwise transformed) for optimization? I am working on a basic isometric game, and am struggling to find the correct mirrors. Mirror can be any form of transform. I have managed to get SE out of SW, by scaling the sprite on X axis by 1. Same applies for NE angle. Something is bugging me, that I should be able to also mirror N to S, but I cannot manage to pull this one off. Am I just too sleepy and trying to do the impossible, or a basic 1 scale on Y axis is not enough? What are the common used mirror table for optimizing 8 angle (N, NE, E, SE, S, SW, W, NW) isometric sprites?


Separate objects for hitbox and sprite? I am making a technically top down game with a shifted perspective. It shows more of the characters side, not just above their head. I think most "top down" games have a similar art style. Due to this, only the bottom of the character sprite should collide and interact with game objects. Should I use two separate objects for the hitbox and the sprite? It seems inefficient to do this. Is there some other solution? For reference, I am using python3 and the pygame library. I am using the sprite class from pygame. My player class inherits from the sprite class and is comprised of a surface object for the sprite image, and a rectangle object for the coordinates and length width. Using a separate object for the hitbox and sprite would require to classes for this.


How can I remove a sprite from the screen using pygame? I am having trouble with removing sprites on my screen using pygame. I am killing my sprite with sword.kill which is removing it from an all sprites group, so it should disappear right? Here is where i blit my images def draw(self) for sprite in self.all sprites self.screen.blit(sprite.image, self.camera.apply(sprite)) pg.display.update() Here is my sword class class Sword(pg.sprite.Sprite) def init (self, game, x, y, entity) self.groups game.all sprites pg.sprite.Sprite. init (self, self.groups) self.game game self.image self.game.sword self.image pg.transform.scale(self.image, (TILESIZE, TILESIZE)) self.image.set colorkey(WHITE) self.rect self.image.get rect() self.x x self.y y self.rect.x x self.rect.y y if entity.direction 'down' self.image pg.transform.rotate(self.image, 90) def update(self) self.kill() And here is where I create my sword object def get keys(self) self.vx, self.vy 0, 0 keys pg.key.get pressed() if keys pg.K LEFT or keys pg.K a self.game.walk sound.play( 1) now pg.time.get ticks() self.vx 200 self.direction 'left' if now self.last update gt self.frame rate self.last update now try self.game.player img self.game.walkleft self.frame self.frame 1 except IndexError self.frame 0 self.swing False elif keys pg.K RIGHT or keys pg.K d self.game.walk sound.play( 1) now pg.time.get ticks() self.vx 200 self.direction 'right' if now self.last update gt self.frame rate self.last update now try self.game.player img self.game.walkright self.frame self.frame 1 except IndexError self.frame 0 self.swing False elif keys pg.K UP or keys pg.K w self.game.walk sound.play( 1) now pg.time.get ticks() self.vy 200 self.direction 'up' if now self.last update gt self.frame rate self.last update now try self.game.player img self.game.walkup self.frame self.frame 1 except IndexError self.frame 0 self.swing False elif keys pg.K DOWN or keys pg.K s self.game.walk sound.play( 1) now pg.time.get ticks() self.direction 'down' self.vy 200 if now self.last update gt self.frame rate self.last update now try self.game.player img self.game.walkdown self.frame self.frame 1 except IndexError self.frame 0 self.swing False elif keys pg.K SPACE self.attack True if self.direction 'down' print(self.rect.centery) self.sword Sword(self.game, self.rect.centerx 7, self.rect.bottom, self) elif self.vx ! 0 and self.vy ! 0 self.vx 0.7071 self.vy 0.7071 self.swing False elif keys pg.K t self.x 1 TILESIZE self.y 1 TILESIZE self.swing False elif self.attack and not keys pg.K SPACE self.sword.update() self.attack False Any help would be appreciated. Thanks!


How do I make 3d Sprites like Myth did 20 years ago? The game that Bungie cut it's AAA chops on Myth The Fallen Lords. about 20 years old now. https en.wikipedia.org wiki Myth The Fallen Lords For the time, it had a pretty revolutionary way of doing lots of "3d" characters, hundreds, on screen and interactive at a time. to accomplish this, basically they use sprites for each character choosing and skewing each sprite based on the camera perspective to make it appear 3d. I would really love to read and learn more about how this technique worked, as I think it can still be applicable to modern indie games, but I've never seen this technique used since. Does anyone know where I could read more on this? here is a youtube of the game being played, showing the characters https youtu.be PySrgfe6pr4?t 6m2s


Limiting the speed of a dragged sprite in Cocos2dx I am trying to drag a row of sprites using ccTouchesMoved. By that I mean that there is a row of sprites (they are colored squares) lined up next to each other and if I grab one with a touch the rest follow it. If a sprite moves off screen I want to append it to the rest of the sprites in formation. However, if the sprite formation moves too fast it creates a slight gap between it and the appended sprites. How do I go about limiting the speed that I can drag the sprite with ccTouchesMoved? This is the only solution I could think of to my problem. If anyone has another suggestion to prevent this sprite gap from happening I would appreciate it. In ccTouchesBegan I loop through the sprites, mark the one that is touched(used for another part of game), and save the distance between the touch point and every other sprite. touch (CCTouch )(touches gt anyObject()) location touch gt getLocation() for (int i 0 i lt grid gt getGridSizeY() i ) for (int j 0 j lt grid gt getGridSizeX() j ) button grid gt button(i, j) button gt setDistanceX(location.x button gt getPositionX()) button gt setDistanceY(location.y button gt getPositionY()) if (button gt boundingBox().containsPoint(location)) button gt setTouched(true) Then in ccTouchesMoved I loop through all the sprites again and set them to always be the same saved distance from the touch point. touch (CCTouch )(touches gt anyObject()) location touch gt getLocation() for (int i 0 i lt grid gt getGridSizeY() i ) for (int j 0 j lt grid gt getGridSizeX() j ) button grid gt button(i, j) button gt setPositionX(touchLocation.x button gt getDistanceX()) button gt setPositionY(touchLocation.y button gt getDistanceY()) This is the update method code only for a sprite moving off the left side of the screen. No point in writing all the sides until I get one side to work for (int i 0 i lt grid gt getGridSizeY() i ) for (int j 0 j lt grid gt getGridSizeX() j ) button grid gt button(i, j) Replaces button if it goes off left side of grid if (button gt getPositionX() lt grid gt button(0, 0) gt getPositionX() button gt boundingBox().size.height 2) button gt setPositionX(grid gt button(grid gt getGridSizeY() 1, 0) gt getCoord().x button gt boundingBox().size.height 2) button gt setDistanceX(location.x button gt getPositionX())


What is the difference between sprites and tiles? I'm making a game, where it came to adding a tile class, but i already have a sprite one, which does the same at first glance. Can you explain the difference with a couple of examples?


Revolve FlxSprites Around a Central FlxSprite in Flash Game made with Flixel I have been working on a Flash game made in Flash Builder using the Flixel library. I have been trying to dynamically create a group of FlxSprites , and revolve them around a player controlled class that extends FlxSprite when the player uses a power up. My thought on how to approach this, was to create a circle, use points on that circle to instantiate the sprites, and then somehow update those sprites to points along that circle during the game's update step. But I am not sure what would be the best way to hold information about a circle, or circular path's in ActionScript 3. I assumed that As3Math provided some of the means to do this, and I tried to add one sprite to a circle like this package import As3Math. import As3Math.geo2d.amBoundCircle2d import org.flixel.FlxGroup import org.flixel.FlxState public class ButterflyRing extends FlxGroup Embed(source ".. Content Images spritesheet butterfly 32x8.png") var butterflySprite Class public function ButterflyRing(playState FlxState,X Number,Y Number) add to super class super() create a circle motion path at coordinates x 150, y 150 with a radius of 100 var butterflyCircle Math.amBoundCircle2d new Math.amBoundCircle2d(150,50) var circDiameter Number butterflyCircle.radius 2 var pX Number butterflyCircle.center.x circDiameter var pY Number butterflyCircle.center.y var butterfly SpriteButterfly new SpriteButterfly(pX,pY) add(butterfly) override public function update() void super.update() I realize now this is not the correct way to use As3Math, that it is accessible by default and you call it like Math.pi. My question is, Does ActionsScript 3 have the means to do this in its code base, or do you have to define your own classes to hold information for a circle, or do you use Math.pi to build circles from scratch? What is a good approach for this? Or does Flixel provide something good for this?


What exactly are sprites and entities and what are the differences between the two? Well I was looking at a few game based tutorials, as well as articles. I found out about two terms Entities and Sprites. Now they seem related but different, what is each and how are they the same and or different? I have some basic ideas already An entity is an item thing object person any object that can be interacted with in the world. A sprite is like an entity, but usually for NPCs players monsters. Or a sprite can be the name of a picture assigned to a specific entity. Do I have the right idea or are sprites and entities something completely different?


Improving shading of procedurally generated pixel art sprites I've been working on a sprite generator and I'm having a hard time figuring out how to add shading automatically. Here are some examples of the generated sprites Currently what I'm doing is checking where a flat color meets a dark boundary, and then applying either a highlight or a shadow depending on the direction. This is of course really boring. I've tried searching for other methods, but all I could find were AI examples. Does anyone know of any particularity simple yet clever ways of adding shading automatically? I've thought of expanding the check up to 5 cells, and using a set of pre determined patterns to generate the shading, but I'm just not too sure


Should I be subclassing CCSprites? When I am working with cocos2d I can add CCSprites to the layer or 'stage' and manipulate them. Now, to do my ongoing calculations for movement AI and such, things that will always run, should I subclass CCSprites and add methods to manipulate themselves and run schedules? OR create a controller class that 'owns' all of the CCSprites and manipulate them from the 'outside'? I am not really sure what would be accessible from the outside though. My guess is that I should probably subclass the CCSprite object, I could have a different object that inherits from CCSprite for each type of sprite needed. Player, Enemy, PowerUp, Bullet, etc... Or what do you think?


How do I make a sprite move to another position using vectors Ok, so far I have made the sprite move to a mouse position. But I got a question, does anyone know how to make a sprite move by itself without the use of a mouseclick from Point a to point b using vectors? In which then the sprite stops after reaching point B. def calcMoveVector(self) movetopos self.posto currentpos self.rect.center directtoX movetopos 0 currentpos 0 directtoY movetopos 1 currentpos 1 vect pygame.math.Vector2(10, 10) if vect.length() gt 0 self.vector vect.normalize() return vect for event in pygame.event.get() if event.type pygame.QUIT sys.exit() if event.type pygame.MOUSEBUTTONDOWN mpos pygame.mouse.get pos() r pygame.rect.Rect(mpos 0 ,mpos 1 ,10,10) buttons pygame.mouse.get pressed() if buttons 0 True c pygame.color.THECOLORS "green2" pygame.draw.rect(screen,c,r) monster.posto mpos monster.state Monster.MOVETO monster.speed 3


How can i create sprite sheet from 3d model (3D studio max) I built simple 3D model of a car, with simple animation in which it's wheels are turning. Now i want to create a sprite sheet, the only way i know how to do it, is to render manually 20 frames from the from, then combine them to a strip manually, then rotate it by 10 degrees, render 20 frames of animation again and combine them to a strip... Is there a way to do it automatically ? With out rotating the scene manually and render it and combining .. it's a lot of work, takes more time then the modelling itself... Thanks


Tool for editing sprites contour pixel alpha value I have seen that most games uses sprites that have a transparent contour, that is, the pixels that belongs to the contour of the object in the WxW sprite image is below 255. It is not perfectly opaque, so that when you render it on screen, you avoid aliasing effects. Is there a tool that automatically loads N .png sprites and process them in order to make their contours semi transparent?


How can I make my character 'flip' in Game Maker? I want my character to 'flip' or 'mirror' when I press 'A' or 'S'. Thing is, I've placed the origin everywhere on the character and he seems to only face one direction. Video showing what I see https www.youtube.com watch?v 1zZEDpO0yAM amp feature youtu.be (This video shows the character not 'mirroring' or 'flipping' properly.) I have done hours of research into this, and I get the same results "Make sure the sprite has the center origin." How would I accomplish this?


What approaches are there to re designing 8 16 bit sprites for HD? I'm new to game development, and my skills with Photoshop are not that great. I was planning to try to convert a old game to HD, but for this I need HD sprites. What is a good way to approach converting 8 16 bit sprites into something like HD? I mean something like this


Drawing Sprites with Artemis I am trying to trace the StarWarrior code (the Artemis tutorial). I cannot figure out how these sprites are being drawn. This is the code where the player's ship is initialized lt summary gt The initialize player ship. lt summary gt private void InitializePlayerShip() Entity entity this.entityWorld.CreateEntity() entity.Group "SHIPS" entity.AddComponentFromPool lt TransformComponent gt () entity.AddComponent(new SpatialFormComponent("PlayerShip")) entity.AddComponent(new HealthComponent(30)) entity.GetComponent lt TransformComponent gt ().X this.GraphicsDevice.Viewport.Width 0.5f entity.GetComponent lt TransformComponent gt ().Y this.GraphicsDevice.Viewport.Height 50 entity.Tag "PLAYER" Which line of code actually leads to the ship being drawn? The drawing takes place in PlayerShip.cs. Here is a commented version of the code with what I think is happening lt summary gt The initialize player ship. lt summary gt private void InitializePlayerShip() Entity entity this.entityWorld.CreateEntity() declare and initialize entity entity.Group "SHIPS" Unused label entity.AddComponentFromPool lt TransformComponent gt () Add the component to store X and Y entity.AddComponent(new SpatialFormComponent("PlayerShip")) Add a component which is just a String (perhaps this has something to do with PlayerShip.cs?) entity.AddComponent(new HealthComponent(30)) Add a health component with 30 hp entity.GetComponent lt TransformComponent gt ().X this.GraphicsDevice.Viewport.Width 0.5f Initialize the TransformComponent's X entity.GetComponent lt TransformComponent gt ().Y this.GraphicsDevice.Viewport.Height 50 Initialize the TransformComponent's Y entity.Tag "PLAYER" Unused label So how is the actual sprite being drawn? Because, I am not seeing it. ( If it is being drawn by entityWorld.Draw() in the Draw() method, then which line(s) of code put it in the world to be drawn? Or what is actually happening in entityWorld.Draw()? I believe the RenderSystem is the one that is doing the drawing, but I don't get how it is being called. I am sorry for the uninformed question, but I have made no progress after about 12 hours, and I desperately need some guidance!


How to combine multiple sprite sheets from multiple sources (Actionscript Starling) In starling, it's faster if you use BitmapText instead of traditional text. Which is well great except for one issue. Right now the sprite sheet I was making was with a single Fla. I just created the sheet from Flash IDE. The bitmap text however is generated using a tool like BMFont . Which generates it's own sprite sheet. Now, imagine I have three or four types of texts . Also for some reason I have multiple Sprite sheets of assets. So the question is, how do I stick multiple sprite sheets together. Is there any available tool for it? Does using multiple sprite cause performance issues?


Are metal slug art assets free use? I'm making a mobile game and I've gotten by with completely free art assets so far, but I have an explosion from metal slug. I love it and it's perfect, but I don't want to get sued. I've seen metal slug art assets posted around the internet on various clip art websites, but haven't found any statements outright saying they're free to use in one's own commercial application. Could someone show me a link saying whether or not metal slug assets are free to use?


How to Make Different Instances of an Object Have Different Sprites In Game Maker, I am trying to make it so that three instances of an object have three different sprites. Using DnD, what would be the optimal way to do this? If it helps, the three instances are different sizes and are in separate, fixed places. EDIT I have added the following, and it gives an error that the global variable has not been set.


Can I use remade sprites in my game? Possible Duplicate How closely can a game resemble another game without legal problems Can I use remade sprites in my game? I am making a game and I used some sprites, but I didn't copy them. I remade them completely the character looks nothing like the original. I only did this to get the movement of the character right (moving, running, jumping, punching). I've been working on the game for a long time, so I really need to know is it safe and legal to do this. I do intend making a small profit.


libgdx sprite position relative to body Apologies if this is a reiteration, as I couldn't find another discussion of this over the past couple days. Issue I'm using libgdx and box2d, and I'm currently updating the sprite's position to the body's current position every render call. Using a debugRenderer to see the bodies, I see that there is fairly noticeable lag between the movement position of the body and the sprite that is being moved relative to it. Question Is this lag normal, possibly to perform collisions ahead of time? If not, should I be manipulating relating the positions differently? Thanks in advance! Solution This was a coding error on my part. Pointed out by a good reply below, I was updating the position of the sprite relative to the body and then stepping the physics. Thus never actually setting the sprite to the body's CURRENT position. Thanks!


Rendering a dynamically sized box So in games where there are textboxes with different sizes appearing, how does one actually render them efficiently? Games like Final Fantasy IX have dynamically sized speechbubbles for example, each with a size so it exactly matches the rendered text. I know the basic idea is to render the frame around the bounding box of the text and with different images for each component of a box corners, edges, center. Though how should one design that rendering if the edges aren't of 1 pixel in size when one has to compute how often an edge piece needs to be drawn next to each other to form the whole edge of the box. Here is my naive implementation of a hopefully good enough abstracted method public void drawBox(Renderer renderer, int x, int y, int width, int height) int es this.components.getEdgeSize() renderer.renderSprite(this.components.getTopLeftCorner(), x, y) Render top edge of box int i for(i es i lt width es i this.components.getTop().getWidth()) renderer.renderSprite(this.components.getTop(), x i, y) renderer.renderSprite(this.components.getTopRightCorner(), x i, y) Render left edge of box int j for(j es j lt height es j this.components.getLeft().getHeight()) renderer.renderSprite(this.components.getLeft(), x, y j) renderer.renderSprite(this.components.getBottomLeftCorner(), x, y j) Render bottom edge of box for(i es i lt width es i this.components.getBottom().getWidth()) renderer.renderSprite(this.components.getBottom(), x i, y j) renderer.renderSprite(this.components.getBottomRightCorner(), x i, y j) Render right edge of box for(j es j lt height es j this.components.getRight().getHeight()) renderer.renderSprite(this.components.getLeft(), x i, y j) int k i int l j for(i es i lt k i this.components.getCenter().getWidth()) for(j es j lt l j this.components.getCenter().getHeight()) renderer.renderSprite(this.components.getCenter(), x i, y j) I feel that some loops did not have to be done and the loop filling the center feels like it could potentially kill the framerate.


Move a 2D sprite into an irregular terrain With a tile based engine, in my knowledge, is not possible to move a sprite into an irregular terrain. So which are the techniques to use for implementing that? Maybe an hexagonal tile based engine?


Fill with Transparency in Built In Sprite Editor When I imported an image for a sprite, I realized it had a white background. I went into the built in sprite editor to remove it. I tried using fill as there was a transparent color in the color selector. It did not work. Is there a way to do this, or an easier way than erasing it all by hand?


Proper way to wrap sprite for Z dimension I am using SFML, but I need to add some emulation of 3D by wrapping the sprite with a Z component. When sprites are drawed (or when objects moved?), their X and Y will change depending on Z. My question is, which component should hold the sprite, and the wrapped x, y, z coords? Supossing I have objects that inherit from Sprite, GameObject and Collider (and I am not yet sure about this or if I rather should have used compositio), I could have A wrapper for Sprite, which could be Sprite3D. Sprite would be the holder of the coords used also for game logic and collision detection. In this case, how do I give access to base class component(?) Collider of Sprite? Collider (inherited or composed?), holding x, y, z. In this case, how Collider would have access to Sprite in order to update it, by having a pointer to parent object casted base class Sprite? Or should the Sprite3D have a pointer to the collider and update its own x,y only when drawing? Wrapper for Both Collider and Sprite. I will need to do this with more drawable types, so this would force me to make other base class Graphic for Sprite. (Yes?) Colliders are drawables? Make each entity have their own x, y, z, and update their sprites and hitboxes


pygame avoiding sprite 'jitters' on rotating the image Is there a common trick for getting around sprites that are changing directions 'too quickly' and causing their sprite to display erratically? In this project, the player moves in 8 directions by determining the abs() distance between the mouse's X and Y coordinates and its own obj.rect.center. If the absolute value is less than obj.speed, it simply moves to that point. If it is greater, it moves the distance its speed allows it to move in that direction. When it's time to draw the sprite, PyGame rotates it in accordance to obj.direction by using a dict called SPINNER with stored default values to pass to pygame.transform.rotate. def draw(obj) drawImg pygame.rotate.transform(obj.img, SPINNER obj.direction ) drawCtr drawImg.get rect(center obj.rect.center) DISPLAYSURF.blit(drawImg, drawCtr) This is fine for the foolish AI characters which typically make very few course corrections however, small movements of the mouse can cause the player's obj.direction to update very quickly, which looks chaotic. Is there a simple way to curb this behavior? My first guess is to bog down the player object with values that retain its previous state and then determine the amount of rotation to apply, but I have a feeling the better solution is to assign that responsibility to the 'view' and not the 'model'. I'm not sticking to any hard and fast rules regarding MVC, but I am trying to engage in enough separation of concerns that 'view like methods' don't make 'controller like' changes to 'model like' objects, if that makes sense.


how to naturally rotate a ball according to its velocity on a surface, a wall I develop a game on cocos2d x cpp. There is a ball sprite in my game. I move the ball on a surface(wall) via touch events but it can't naturally rotate according to its velocity. if i use ballSprite runAction(..) in update(float dt) method then it doesn't rotate. i use following code void GameLayer updateBall(float dt) float deltaRotateX 360.0f ballVelocityX ballSprite gt setRotation(90.0f CC RADIANS TO DEGREES(deltaRotateX)) But the ball doesn't naturally rotate. it discretely rotate. it can't naturally rotate according to its velocity. Thanks.


Alternative Font loaders in Monogame Framework While working on projects of mine, I have been finding that it is a huge pain to switch operating systems just to create a simple spritefont when using Monogame. I saw that the Nuclex Framework can load fonts which are clearer sharper, and they can be used in a Monogame project as well. They load fonts using the FreeType library, which is very multiplatform and is used widely. Is there a fairly simple way to use the FreeType library or another library to render text suitable for use in a Monogame project, as an xnb file?


Loss in quality on downsized sprites in Game Maker I'm having an issue with sprites quality in Game Maker. I have some sprites used for UI with an original size of 2048 512. I need to resize them in game to 512 128. But when I do, I got a loss in quality. This is the original picture, resized to 512 128 with a third party software This is the sprite, as it appears in Game Maker room editor (and in game) once resized to 512 128 Are there general guidelines for this kind of situation? By the way, it's on Windows. Though I tried launching the game on an Android device and the result was the same.


Problem with preloading plist file in Cocos2d x I am using Cocos2d x engine with 3.2 version. In my splash screen I am prefeching a plist by below line SpriteFrameCache getInstance() gt addSpriteFramesWithFile("ui.plist") Now inside game when I am creating a sprite I am getting an assert fail error Sprite ss Sprite createWithSpriteFrameName("pause.png") Assert failed Invalid spriteFrameName pause.png Also when the splash screen is removed, I am getting the below line in console cocos2d TextureCache removing unused texture D cocos2dx projects ABCD Resources mid ui.png Is there anything I need to add or something? I was doing the same thing for 2.x and was working but not in 3.2 EDIT In 3.x if you are calling this line Director getInstance() gt purgeCachedData() , remember that it will delete all textures from the cache memory. So handle all sprite sheets manually.


Displaying sprites in a 2.5D raycasting engine I'm developing a raycasting engine like the one used in DOOM, Wolfenstein 3D, etc. My engine is capable of correctly displaying walls and textures on walls, but I'm stuck at sprites rendering. Given that my engine is based on lines and angles only (just trigonometry), is there a way to render sprites without going for matrices? And if so, which technique should I use?


Tiled map editor and objects Ive been searching for an easy way to group multiple sprites of a spritesheet into a single entity. Im using tiled editor as written at the title. Some objects might be larger than the tile size and i need a way to let my game know that in order to manipulate these objects. I dont want to create new tilesets with different sizes for all objects. Is this possible in this app and if not do you know another that can handle this?


How to change the sprite of an object from another's script? I have an object A and an object B, I want that when object B is in a certain position, the sprite of object A changes to that corresponding to that position, how do I change the sprite of object A from the script of object b? The image may give them an idea of what I want to do, object B is the glove, And the object A is the viewer. Tansk form any help.


Are 3D textures used for ground tiles in 2.5D games? In an isometric system, each tile can be painted with texture. Normally, (if I recalled the technical term) the fastest method to paint these ground tiles with appropiate texture is to use something like UV mapping. However, that is not what I have seen on most of isometric tile based game (such as final fantasy tactics). For example, if I map the texture onto each grid, then the texture would appears to be flat. Now, in modern day game, each tile may have some part sprouting out (for example, grass). What I want to ask is how should I implements the isometric system such that this feature is supported? The next problem is, if I implement such feature, then I have to make change to the art process too UV texture mapping will not work anymore. My question is, what change would I have to make to the art process? How would an artist color a 3D isometric tile? Basically, I just want to know how this isometric system will work out for both programmer and artists. The grid system seems to require high degree of coordination between programmer and artist. EDIT Rephrase the question


How can I get the width and height of a picture? I'm trying to make a script on RPG Maker XP that needs the width and height of an image to do some calculations. I tried picture.bitmap.widthand picture.bitmap.height but it returned the width and height of the image that is being shown in the screen. For instance, if the image is 800 pixels height, and the image takes 400 pixels in the screen, picture.bitmap.height will only return 400. This is the code I'm using picture Sprite.new picture.bitmap RPG Cache.picture("picture") pictureWidth picture.bitmap.width pictureHeight picture.bitmap.height


In AGK2 Basic, how would I attach a camera to the player charater? I've started making a game in AppGameKit and I'm using Tier 1 AGK2 Basic. I'm trying to make a sort of endless runner. I've made it so that the player stays still and the rest of the world moves around them to create the illusion that the player is what is running forward. I then use a global variable to control all movement relative to the player. There must be a better way to do this, though. Like if I were to attach a camera to my player character. How would I do something like that?


Making a 2D Game Figuring out sprite sizes? I'm currently making a 2D game as a school project using Game Maker and its language. My concern however is around the spriting and art... I can't figure out how to correctly size everything so it shows up correctly on the end product. I originally used a temporary 32x32 character but it looks very small when I have the "Room Size" in Game Maker set to 720p... Is this something that I need to change size wise on Game Maker, such as changing how far in the perspective camera is, or do I have to set actual dimension rules? I'm unsure of how to do this properly.


Designing for multiple screen resolutions and aspect ratios, target one resolution then scale to meet others or use normalized values? I feel like what I'm currently doing is stupid but would just like reaffirmation it is. Basically I'm writing games which target a certain screen resolution (800x480), so all positions, widths and heights I set for sprites is for that resolution. On the engine side I have special scalers which will change the width and height of what is being drawn to meet the current platforms res, so for example if the platforms screen res is 1200x720 I will stretch a sprite by a factor of 1280 800.0f 720 480.0f Positions are also offset and manipulated in a similar way. I really feel I should move to a normalized system for widths and positions (i.e. 0 to 1) but at the same time feel this is more intuitive since the first platform I target is 800x480 and I already kind of have a good udnerstanding of dimensions and such for that. So my question is, is it really that bad to target a specific ccreen res then in the engine side modify this res to meet different platforms?


Acceleration and Deceleration During Rotation I'm attempting to have a sprite rotate in a way where its rotation speed increases until it has reached the halfway point in its rotation, to which it starts to slow down. I'm currently calculating the halfway point by calculating the amount of time it should take to rotate the sprite, and then checking if a current time variable is larger. The code works rather well except for the fact that I can't figure out how current time should increment each update. Currently I'm using delta time, but that doesn't work. I'm thinking it needs to be some combination of the calculated time to rotate and delta, but I haven't gotten it yet (clearly). EDIT Specifically, currentTime shouldn't be incremented by delta solely, but I have no idea what it should be in place of delta. if (currentTime lt timeToRotate) rotationSpeed 5f delta currentTime delta else if (rotationSpeed gt 5f) rotationSpeed 5f delta else rotationSpeed 5f currentTime delta


MonoGame sprites not consistently drawing Please don't mark this as a duplicate of my previous question which was asked anonymously. this is a reattempt because i cannot edit the first attempt. What I have so far is randomly generated tile set with items on SOME tiles one creature spawner that spawns up to 5 creatures which can be controlled by the player the ability for creatures to pick up items and bring them back to the spawn and store them for later use What I am noticing is when i launch the game, it doesnt always show all the sprites. Sometimes the spawner is missing, or the creatures, or the GUI. ANd when things DO appear, if i tell the creatures to pick up anything, other items on the ground randomly appear and disappear. even the spawn sometimes disappears! what I do notice is that when i have multiple creatures, some will disappear when crossing invisible lines but not all of them. i forced two creatures to go east at the same speed and time, and one vanished and the other didnt. If you have any ideas as to what might be causing this, please let me know. if you have any questions, i'll try to edit to appease you. thanks for reading! I have my draw method like this GraphicsDevice.Clear(Color.CornflowerBlue) TODO Add your drawing code here spriteBatch.Begin(SpriteSortMode.BackToFront, null, null, null, null, null, camera.GetTransformation()) worldEntity.Draw(spriteBatch) guiManager.DrawGUI(spriteBatch) spriteBatch.End() base.Draw(gameTime) for the world entity... its draw method systematically goes through each tile in the world and calls its draw method. the tile draws itself using Vector2 topLeftOfSprite new Vector2(this.X, this.Y) Color tintColor Color.White spriteBatch.Draw(tileTexture, topLeftOfSprite, tintColor) and then proceeds to call the draw method of any items on it. creatures and items have very similar draw methods. the gui also draws itself in a similar fashion. what i DO notice is that ive NEVER seen ground tiles vanish, only the items on them or creatures in the world. Could it be their Z isn't set appropriately?


Concerns about how to efficiently implement sprite atlas I currently transform (translate, rotate, scale) a bunch of vertices in my own Java code, then populate an mPositions array and an mTextureCoordinates array, which draws a bunch of different textured sprites to the screen in one GL draw command. Works great. However, I now wish to move the transformation process away from native Java code and over to the vertex shader, and so I will need to pass into the shader transformation matrices which encode the translation, rotation, and scaling operations for each sprite. Given my current approach the naive and obvious choice is to introduce another array mTransformations, passed into the shader via a GLES20.glVertexAttribPointer command, which contains a matrix for each and every vertex. But this way seems a little wasteful for two reasons I will have to add the same transformation matrix 6 times per sprite to the mTransformations array since each square sprite is made of 2 triangles (3 3 vertices) Since I'm now going to use the shader to perform the transformations, the 6 canonical coordinates of each square sprite (two triangles) will be the same for every sprite. In effect I'd have to populate mPositions with the same coordinates over and over for each sprite. Is there a more efficient way to do achieve what I want?


Slicing irregular spritesheet (automatically?) If found a cool sprite sheet on the internet but its irregular. Is there any way besides manually cutting sprites to extract the separate pngs? I need to pack them then again into the Texture Atlas under proper names. Maybe theres some smart online tool that uses deep learning or something like that?


How can I remove a sprite from the screen using pygame? I am having trouble with removing sprites on my screen using pygame. I am killing my sprite with sword.kill which is removing it from an all sprites group, so it should disappear right? Here is where i blit my images def draw(self) for sprite in self.all sprites self.screen.blit(sprite.image, self.camera.apply(sprite)) pg.display.update() Here is my sword class class Sword(pg.sprite.Sprite) def init (self, game, x, y, entity) self.groups game.all sprites pg.sprite.Sprite. init (self, self.groups) self.game game self.image self.game.sword self.image pg.transform.scale(self.image, (TILESIZE, TILESIZE)) self.image.set colorkey(WHITE) self.rect self.image.get rect() self.x x self.y y self.rect.x x self.rect.y y if entity.direction 'down' self.image pg.transform.rotate(self.image, 90) def update(self) self.kill() And here is where I create my sword object def get keys(self) self.vx, self.vy 0, 0 keys pg.key.get pressed() if keys pg.K LEFT or keys pg.K a self.game.walk sound.play( 1) now pg.time.get ticks() self.vx 200 self.direction 'left' if now self.last update gt self.frame rate self.last update now try self.game.player img self.game.walkleft self.frame self.frame 1 except IndexError self.frame 0 self.swing False elif keys pg.K RIGHT or keys pg.K d self.game.walk sound.play( 1) now pg.time.get ticks() self.vx 200 self.direction 'right' if now self.last update gt self.frame rate self.last update now try self.game.player img self.game.walkright self.frame self.frame 1 except IndexError self.frame 0 self.swing False elif keys pg.K UP or keys pg.K w self.game.walk sound.play( 1) now pg.time.get ticks() self.vy 200 self.direction 'up' if now self.last update gt self.frame rate self.last update now try self.game.player img self.game.walkup self.frame self.frame 1 except IndexError self.frame 0 self.swing False elif keys pg.K DOWN or keys pg.K s self.game.walk sound.play( 1) now pg.time.get ticks() self.direction 'down' self.vy 200 if now self.last update gt self.frame rate self.last update now try self.game.player img self.game.walkdown self.frame self.frame 1 except IndexError self.frame 0 self.swing False elif keys pg.K SPACE self.attack True if self.direction 'down' print(self.rect.centery) self.sword Sword(self.game, self.rect.centerx 7, self.rect.bottom, self) elif self.vx ! 0 and self.vy ! 0 self.vx 0.7071 self.vy 0.7071 self.swing False elif keys pg.K t self.x 1 TILESIZE self.y 1 TILESIZE self.swing False elif self.attack and not keys pg.K SPACE self.sword.update() self.attack False Any help would be appreciated. Thanks!