Tag Info

New answers tagged

0

Let me put this simply. (Or I will try to) First of all, you should read up on Vectors, find out what these are: Vector Magnitude; Vector X,Y coordinates; Normalised Vector; After this, you should read up a bit on physics, especially Newtons three laws; kinetics; momentum; and collisions. After a week or so you should start to understand these ...


0

You will get all needed informations in the official documentation: see Manual: 2D Textures. Basically you can control the "quality" of textures by tweaking the compression format and filtering mode.


1

If you need good image quality you can use Format: Truecolor or ARGB 32 with an high Max Size and avoid compression: You can try playing with Filter Mode and Aniso Level too in the advanced settings:


0

If you are trying to use tile dimensions to break up the fact that its a tiled game, you should check out Wang tiling. Its a really nice way to make tiled graphics that looks organic and non tiled. http://blog.demofox.org/2014/08/13/wang-tiling/


0

Your problem is most likely the fact that you create copies of your blocks when adding them to your vector. That way once the original copy/block is destroyed, the texture won't be valid anymore (since there's a shallow copy happening, so even the new copies still point to the old texture, despite having their own copy). As a potential fix, change your ...


0

I am the guy who asked this question. When I asked this question I didn't knew much about sprites and textures, but then I learned quite a lot from the internet and sfml tutorials. Actually what I was doing in the program was not correct. I was storing the texture in a local scope which was getting destroyed at the end of the scope. Textures should be stored ...


0

The simplest solution is to keep textures in World class, like this: class World { public: World(); void draw(sf::RenderWindow *window); vector<Block> blocks; private: int level[12][16]; int wd; int hi; sf::Texture Texture; }; And definition: World::World() { if ...


0

If you are doing webgl and can make pixel shaders, check out signed distance textures. They are textures but scale like vector graphics. http://blog.demofox.org/2014/06/30/distance-field-textures/


2

System.currentTimeMillis() should be changed to System.nanoTime() / 1000000; currentTimeMillis has an issue in it that sometimes comes back with a weird number and in games causes twitching in animations and graphics


-2

1) Because if you want to use the sorting layers in unity, you can't use many of the materials that are available but only a few. 2) You're limited to only a few materials, which work in harmony with unity's sorting layers. Cheers!


1

I don't think you need XNA any more. Just double click on Content.mgcb to open the content editor. Right click on Content -> Add -> New item -> Spritefont description, give it a name, e.g. "testfont" Load your spritefont in game: var font = Content.Load<SpriteFont>("testfont"); Use it! spriteBatch.DrawString(font, "hello", new Vector2(10, 10), ...


0

Well in UI, you can use more stuff to help you. For example, grid layout which helps you align all the pieces in grid automaticly. Also handling mouse events is way easier with ui elements, eg for drag and drop there are events for that. There is also option to use UI inside world space.. Ps: im writing this answer on mobile. I can provide more info later ...


0

In my experience these are the two most important differences between Sprites and UI Images: 1. Images need to be inside a UI Canvas and they use a RectTransform instead of the regular transform. This means they can use the new anchor/pivot features and their positions will be in pixels instead of units. 2. It's more convenient to handle clicks and other ...


0

A quick test, just grab the logo image from the SFML site and paste it into the working directory of your project (or just somewhere simple and explicitly state that in code i.e. "C:\test\img.png") #include <vector> #include <iostream> #include <SFML/Graphics.hpp> int main() { sf::Texture texture; if ...


0

You appear to be correctly storing a texture and then setting that texture to a sprite, so I don't think the White Square problem they're referring to in the documentation applies to you in this situation as you don't have the texture being created in a local function scope etc. std::vector<T>::push_back() creates a copy of the argument and stores it ...


1

I'm not familiar with flash/as3. This said, I fail to see what instance would be the parent to the child you're adding with addChild in a static method. Here is the description from the documentation Adds a child DisplayObject instance to this DisplayObjectContainer instance. The child is added to the front (top) of all other children in this ...


8

Tiles and icons (even in UIs like window systems) are often in a size like 16x16 or 24x24 to make it easier to modify the tiles. Most times the tile size is a multiple of 8 because of the folowing reasons. It is relatively easy to shrink a tile with the size 32x32 to 16x16 by simply putting 4 pixels together (e.g. create the median/average of the 4 ...


0

Create an arrays for each direction of running index. So, if there is one direction the player can move, all the player can do is either run or not run. You have a single array. Say the that your animation requires 3 poses: both feet down, left leg up, right leg up. You place them in an array as indexes 0,1,2 respectively. Then your run_annimation array ...


0

I think it's simple! Just use TextMesh and draw it over the Sprite.


2

Sprite Sheets with a Uniform Grid The easiest form of sprite sheets, are sheets that use a uniform grid to lay out the individual sprites of your object. Your sheet is essentially a grid with a certain number of rows and columns of cells. Each cell contains a single sprite. Using a uniform grid, means that all cells have the exact same dimensions. ...


0

Think about having only one final Tile class and it defines only the data needed to render and update like the id of the Sprite or TextureRegion public class Tile { private int type; private int spriteId; some other data that you need and that belongs to a Tile ... public int getType() { return type; } public int ...


1

Using an atlas: You can pack the left and right versions into a single texture for each sprite, and only swap UV's based on the player's direction. Although you may put only left/right images into the textures, will your modders? A few descriptors to think about: bool AutoFlip; //Swap UV's based on L/R? bool ReverseTextures; //Reverse standard ...


2

When you rotate the transform object, rotate the velocity vector by the same amount.


0

This functions should scale the sprite proportionally so it fits the camera width: void fitCameraWidth() { SpriteRenderer sr = (SpriteRenderer)GetComponent ("Renderer"); if (sr == null) return; // Set filterMode sr.sprite.texture.filterMode = FilterMode.Point; // Get stuff double width = sr.sprite.bounds.size.x; ...


0

I think you have to weigh the cost / benefit of loading larger assets into your project verses dealing with scaled game objects within a scene. Personally I keep my assets at actual size, smaller the better and throw them into a sprite sheet, and scale them up within the editor. FilterMode Point is so crunchy works just fine for me! and from everything I ...


0

Having all Tiles be Actors that draw their sprite in the Actor's draw() call is an option. Of course there are many ways to draw a map, but this definitely is one of them. However I would warn against using Sprites. Since you said all tiles are 16x16px you will likely have very many of them in each level of your game. This would mean that you would have ...



Top 50 recent answers are included