Tagged Questions
1
vote
1answer
110 views
How to compress Unity apk output?
I made a game with Unity but the size of .apk file got so large, it is about 70mb...
Is there some way that I can compress my apk file?
13
votes
3answers
2k views
Best way to store game-wide variables
I have an options Screen for things like Difficulty, Resolution, Full Screen, etc but I'm struggling to find the best way to store/obtain these variables at game time.
The way I've currently decided ...
0
votes
0answers
65 views
C# graphics framework for 2d games [closed]
I am looking for a 2D graphics framework for my game. When searching for a graphics framework for c# you get a few results. MonoGame, xna, slimDx, direct X, openTK and c#'s graphics class.
Xna - no ...
0
votes
1answer
54 views
Detecting Hitbox Collisions (Rectangle)
So I have some Hitboxes set up on 2 classes, HealthPickup and Player.
public static Rectangle Hitbox;
public override void Initialize()
{
Hitbox = new Rectangle(Pos.X, Pos.Y, 32, 32);
}
That's ...
0
votes
0answers
108 views
Zelda-style Top-down RPG. Storing data for each tile type
I'm creating a Zelda-style RPG using Tiled, C#, and MonoGame.
When my code parses the .tmx file, it will get a number to associate with each tile type based off of their position in the tile sheet. If ...
1
vote
1answer
170 views
How do you make a bullet ricochet off a vertical wall?
First things first. I am using C# with XNA. My game is top-down and the player can shoot bullets. I've managed to get the bullets to ricochet correctly off horizontal walls. Yet, despite using similar ...
4
votes
1answer
212 views
Unity falling body pendulum behaviour
I wonder if someone could provide some guidance.
Im attempting to create a pendulum like behaviour in 2D space in Unity without using a hinge joint.
Essentially I want to affect a falling body to ...
0
votes
1answer
181 views
How to properly handle top down 2D collision?
I can never seem to get this right, well polished at least. I'm creating a top down game in XNA, and collision has always been an issue for me to do properly. Detecting collision is fine, but ...
2
votes
2answers
120 views
XNA: Non-overlapping shadows
I want to create an effect similar to the following in XNA / MonoGame:
There's a background and a semi-transparent shadow consisting of several objects (two circles in this example). However, the ...
1
vote
1answer
126 views
How to correctly handle multiple movement key presses resulting in double the speed?
I am trying to implement acceleration and drag into my top-down 2D game. The player can move using the WASD keys. Acceleration works fine, but the way I handle the directional velocity causes the ...
2
votes
1answer
87 views
Issues with 2D Body/Limb system [closed]
In my game I have programmed Body and Limb classes. The Body is guaranteed to have an origin in the center of its sprite. The Body class has a List of children Limbs, each with their own offset. Every ...
1
vote
1answer
102 views
How to rotate vertices of 2D shape using a transform matrix?
I am making a top-down 2D game and am currently working on implementing improved collision using SAT. I programmed a Shape class with a Vector2 center that is its position in world space. On top of ...
2
votes
2answers
80 views
How to use camera transformation without depending on (1,-1) scale during spriteBatch.draw()
I am creating a 2D platformer type game in XNA.
I currently have a camera object, with a position/rotation/zoomlevel that I use to generate a transformation matrix to pass to SpriteBatch.Begin(). ...
0
votes
1answer
110 views
Tile System with moving Platforms
I am using a tile based system where the level is stored in a char:
char[,] Level2 = {{'.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.'},
...
0
votes
1answer
1k views
Change the sprite of a Object in Unity
Inside the script code of the the hero(object) I want add the possibility to change its sprite.
So the player hits the space button and the sprite changes into the other sprite already added to the ...
1
vote
2answers
1k views
Unity 2d: How stop movement when object hit a wall
I created a square that slides on a flat ground.
public class PlayerMoveScript : MonoBehaviour
{
float move = 0;
void Start (){}
void FixedUpdate ()
{
if (move == 0) {
...
0
votes
1answer
231 views
XNA 2D Camera, zoom into player
My 2D camera follows the character fine without any zooming. However, when I tried adding a zoom feature using the Matrix.CreateScale(), the camera no longer follows the character properly.
public ...
1
vote
1answer
221 views
Unity seperation of prefabs with two dimensional terrain generation
I have the following function:
public void Spawn ()
{
GameObject g = ((GameObject)Instantiate (hills [Random.Range (0, hills.Length)], new Vector3 (0.0f, ...
0
votes
1answer
1k views
Switch character to play animation() in Unity3D using c# [closed]
I have two or more 2D character (Character A, B, n..).
I made an animation on the character using the Animator class "AnimCharacter.cs".
if i press the 'PgUp' character 'A' can call the function ...
1
vote
1answer
197 views
Strange collision behaviour in 2D game even though the collision is very basic [closed]
I have a player ship (cube) and some enemy laser projectiles. When the player ship has position X values greater than 1, collision with the enemy projectiles occur but when it has lower X values, the ...
1
vote
2answers
164 views
XNA blurring moving images
Why does XNA blurs the images which moves less than 1px in between two draws? It is quite annoying, because everything looks really blurry. Is there a way to disable it?
I have tried to set the ...
2
votes
1answer
126 views
2D lighting causes black rings to appear
A year ago I implemented 2d lighting in XNA using sprites.
The sprites I used were created by placing a soft white photoshop brush on a transparant background.
The result was this: (lights only)
...
2
votes
1answer
178 views
Unity Get corners of camera in world space
I'm making a 2D game and i need to get the corners of the camera in world cordinates. Is this possible in unity?
2
votes
1answer
125 views
How to smoothly track and draw player movement?
I am currently using C# XNA Framework to simply connect some development concepts that I've learned/used over the past few months. Right now I have a Web Service that keeps track of connected clients ...
5
votes
2answers
958 views
How do I make a 2D game resolution independent?
I'm working on a simple 2D game. I've finished the mobile phone version.
However, my boss wants the game to works on his RT.
I'm doing the "conversion" but my buttons are in the wrong places, because ...
1
vote
1answer
99 views
Better way to handle ordering and visibility of renderable objects?
I'm just wondering whether there is a more effective way to handle the ordering and visibility of renderable components that fits into the design of my already existing engine.
How I do it now:
In ...
0
votes
1answer
1k views
Random terrain generation with caves
I am currently working on a small game that will generate a world with caves and entrances to the caves, something like Terraria if you will. Today I reached some trouble on the world/cave generation ...
0
votes
1answer
54 views
Farseer Circle Body Problems, Please help!
I have created a circle body class, but in game my player body just passes through it. the circle will not move, only rotate.
however when i create the circle body just straight up, raw in the game1 ...
1
vote
1answer
224 views
Lighting Covering Up Sky ( XNA / C# )
I have a 2D tile-based lighting system which is drawn onto a Render Target.
I am also drawing a background which involves mountains, sun/moon, and clouds.
There is also the unlit game; blocks, ...
2
votes
2answers
253 views
Large resolution differences
I want to develop a game on multiple devices such as PC, Android or IOS.
Want it to be in 1080p, but that means a massive scale down for the smartphones.
I know how to do that, just render everything ...
0
votes
1answer
159 views
Efficient approaches to updating adjacent grid tiles when one tile is disabled?
I'm trying to update the surrounding grid of tiles if one of them is disabled (not removed). For example, imagine we have a grid of tiles each with x representing one texture:
x, x, x, x, x, x
x, x, ...
2
votes
2answers
1k views
Algorithm for continuously generating a tile map for a topdown 2D game? [duplicate]
In essence, what I'm looking for is a procedural 2D tilemap continuously generated in a fashion like Minecraft - which is to say generated as the player approaches the edges of the already explored ...
0
votes
1answer
110 views
Why do I get an exception when accessing my sprite members in this fashion?
I'm getting a NullReferenceException error on the line where I do new Vector2(...).
I think the problem is with the variables I'm using even though they're working to control the player sprite, so ...
1
vote
1answer
302 views
Grid-Based 2D Lighting Problems
I am aware this question has been asked before, but unfortunately I am new to the language, so the complicated explanations I've found do not help me in the least.
I need a lighting engine for my ...
0
votes
1answer
167 views
Obtain rectangle indicating 2D world space camera can see
I have a 2D tile based game in XNA, with a moveable camera that can scroll around and zoom.
I'm trying to obtain a rectangle which indicates the area, in world space, that my camera is looking at, so ...
1
vote
1answer
183 views
How could I figure out the shortest way to turn, and whats the angle? [duplicate]
I'm creating some robots for my tank game. I want them to find each other and shoot each other down, so I'm trying to implement a way for them to turn towards each other, and turn the shortest way. ...
4
votes
2answers
154 views
What's involved in resetting the graphics device?
I'm playing with XNA 4.0, VS2010. I've created a window (not maximized) and drawn some sprites. All is good until I resize the window, after which the sprites stop displaying or only partially ...
7
votes
1answer
717 views
Implementing water effects (splashes) into XNA 4.0 game [closed]
I am creating a 2D XNA game and came across a tutorial on adding water effects (splashes) to an XNA game but after implementing it into my game I can't get it to scale down. Currently it takes up the ...
0
votes
1answer
143 views
Formula throwing a ball to destination [duplicate]
I am throwing a ball using this:
double v, vx, vy, alpha, t2 = 0;
if (Keyboard.GetState().IsKeyDown(Keys.Up))
{
alpha = MathHelper.ToRadians(60f);
v = ...
8
votes
5answers
4k views
Designing a flexible tile-based engine
I'm trying to create a flexible tile-based game engine to make all sorts of non-realtime puzzle games, just as Bejeweled, Civilization, Sokoban, and so on.
The first approach I had was to have a 2D ...
-4
votes
2answers
439 views
2D Graphics in CMD in C#
So, almost every programmer used Doom as inspiration for new Projects, right? So Doom and other classic MS-DOS game were played on something like Command Prompt. How do you display images in Command ...
1
vote
2answers
250 views
XNA spritebatch.Draw: Which part gets colored by the color parameter?
Which part gets colored and how can I control it?
I have a rounded block and my goal is to have the center filled with a certain color chosen by that parameter. Here's the picture:
...
1
vote
3answers
359 views
Splitting tileset into individual tiles
I'm trying to split a tileset (from here) into individual tiles.
For debugging purposes I wrote some code to split the tileset into individual tiles and display them on screen, but some aren't being ...
1
vote
3answers
194 views
Creating an update “Tick” on tiles for simulating growth of plants
In my 2D tile based platformer I have added plants to be able to farm such as the simplest, grass, to other things like corn. Now each of these speacial tiles must be updated to show how much it has ...
1
vote
2answers
663 views
Resolving 2D Collision with Rectangles
For about a week I've been trying to grasp the basics of collision, but I've been driven to the point of wanting to just give up on everything when it comes to collision. I just don't understand it. ...
39
votes
3answers
8k views
2D water with dynamic waves
New Super Mario Bros has really cool 2D water that I'd like to learn how to create.
Here's a video showing it. When something hits the water, it creates a wave. There are also constant "background" ...
-2
votes
3answers
771 views
Why use textures that are Power of Two? [duplicate]
Possible Duplicate:
Why are textures always square powers of two? What if they aren’t?
I am using C# and XNA (also MonoGame for other platforms than Windows) to create a game in 2D. ...
-3
votes
1answer
535 views
2D XNA Shooting Game [closed]
im doing a XNA game for a school project but im having trouble with the bullets. I can´t find any way to draw them or "invoque" them went i want. It is a modified Space Invaders that im trying to do. ...
5
votes
2answers
477 views
Ball bouncing infinitely and constantly
Alright, so I've got hold of some simple physics mechanics, and am currently trying to implement bouncing. Based on the first answer of this question, I've developed the following algorithm:
...
3
votes
1answer
186 views
Figuring out which direction my object is facing on a 2D plane?
My friend and I were messing around in XNA 4.0 making a 2D racing game. Kind of like this one: Ivan “Ironman” Stewart’s Super Off Road. The problem we are having is knowing which direction the car is ...