Tag Info

New answers tagged

0

I suppose what you mean by "change its sprite" is to change its texture. If so, have you tried something similar to this? // Inside a co-routine after you have started playing the animation "my_sprite_anim"... float previousTime = 0; while (animation.IsPlaying("my_sprite_anim")) { // A value of 1 is the end of the animation. A value of 0.5 is the middle ...


0

I personally haven't used the method your using. But since you have asked if there is another way to do this... Suppose you have a texture atlas (texture made up of sub-textures) where each sub-texture has the same dimensions: Then if you create a RECT R = {j*64, i*64, (j+1)*64, (i+1)*64}; ->Where int j = currentFrame / 6 //row ->Where int i = ...


1

By computing the velocity as some factor of the difference between the start and end position, you can achieve the association you want: var velocity = (endPosition - startPosition) * scale; The hard part be will choosing a value for scale. You can initially try constants -- such as 1.0f or 0.5f. This makes the velocity directly proportional to the start ...


0

If you don't need fancy texture in your fonts, Unity supports True Type fonts, so you can render your text easily using the GUI system (for instance, drawing a Label). In order to use Bitmap fonts you'll have to write the code yourself to translate the characters into sprites, or use one of the libraries available, like NGUI or Daikon Forge.


0

What I would likely do is convert the rectangle to a Pixmap, then, assuming the rectangle has a solid single color border (with a different color than the rest of the rectangle), I would simply iterate through the pixels in the Pixmap looking for the border color and save all the positions to an array. Then all you would have to do is periodically set the ...


0

If you watch the trees you can clearly see that a perspective camera is in use as it changes relative to the viewing angle. The fact that some things are drawn over other implies that a depth value is also in use so we have a 3D data set. Therefore, because there is a perspective camera being used to render a 3D data set it's likely that a standard 3D ...


1

I suspect that there are several tricks in play. It is entirely possible that the game camera or view is a 3D perspective camera and all the sprites are placed in a 3D environment just at different heights. there could also be some clever parallax effects going on here. I would most likely suspect that this is in fact either a 3D or "2.5D" game or it is a ...


0

If you're looking for a really simplistic approach, here's one I've used in the past: Create an object that has both sub-objects (rectangle and circle) Create a getter/setter pair for x/y coordinates on your object When you move the object by calling setX(x), it sets the rectangle's x coordinate to x, and the circle's x coordinate to x + a where a is the ...


0

assuming by sprite you mean that it is an image (loaded from a bitmap): i would iterate through the pixels in the image, and identify the ones on the edge (adjacent to a transparent pixel) (or load an identical black and white hollow rectangle image showing only the edge points for easier identification) log those Points into an array by starting at one ...


3

I assume you will be using some modern rendering API to draw to the screen, such as OpenGL or D3D. You will certainly want to batch sprites as much as possible and use sprite sheets to reduce the number of textures. A sprite sheet is nothing more than a Texture Atlas (also read this). Once you have a Texture Atlas up and running, it will be up to you how you ...


0

If you mean, you want to lay out multiple subtextures onto one big texture, then yes there are advantages to that. This technique is called a "Texture Atlas". The first advantage is that you will end up with less resource files in your project. For example, if you want to texture the six faces of a cube with different textures, you'd end up with 6 texture ...


3

Multisampling AA (MSAA) is only capable of multisampling the geometry edges. If you want your sprites to be anti aliased, you should use a post process AA, like FXAA for example. You can also use bilinear filtering to smooth out the texture itself (it seems that you are using point/nearest filtering). Having multiple mip-maps for your textures can also ...


3

One thing you can do is not let the character travel diagonally when the path crosses the corner of a wall. The character is free to travel diagonally out on the open, but not next to a wall. This is done in your a* algorithm.


3

Yes you should factor the size of the character into the A* calculation. There are basically two ways you can either make your character larger, which complicates the computation. Alternatively you can make the wall wider and pretend your character has 0 width.


0

I pretty much find the source of the problem. When i was launching the game, the memory of the game was litterly growing every second (+10K Ko / s). I isolated the problem and the source of it is this "part" of code : protected boolean collisionInEntity(float x, float y, float xObject, float yObject, int collisionHeight, int collisionWidth) { Rectangle ...


0

Spawn the sprite when the appropriate event or conditions for spawning are met. Flixel gives you an update method that runs periodically. For example, in the Flixel platformer tutorial, the update method is overridden thusly: override public function update():void { player.acceleration.x = 0; if(FlxG.keys.LEFT) player.acceleration.x = ...


0

I think you could accomplish this by applying the following algorithm (shown in pseudocode): rotateEnemyAndArrow() { start = arrowPointOfContact - enemyCenter destination = start.rotate() // Rotate the start vector by the enemy's rotation enemy.rotateAroundPoint(enemyCenter) arrow.rotateAroundPoint(arrowPointOfContact) arrow.translate(destination - ...



Top 50 recent answers are included