Questions tagged [2d-games]

2D games are drawn in a two-dimensional space using two-dimensional objects. To represent its position, each game object will have an x and a y coordinate.

Filter by
Sorted by
Tagged with
38 votes
2 answers
58k views

How to extract part of this image in Java? [closed]

I have this sprite sheet: How can I read this image file to extract part of it to be used as a sprite ?
Ali's user avatar
  • 265k
36 votes
1 answer
25k views

Canvas vs. SVG for games [closed]

I realize there are many tutorials and sites and everything answering "Which is better for game applications?" They all say that SVG is not suited towards game applications, that canvas is. But this ...
RoboticRenaissance's user avatar
29 votes
5 answers
74k views

Unity 4.6 - How to scale GUI elements to the right size for every resolution

The new Unity 4.6 comes with a new GUI, when I change de resolution on Unity the UI Button scales perfectly but when I test on the Nexus 7 device the Button looks too small. Any idea how to solve this?...
benLIVE's user avatar
  • 597
27 votes
6 answers
179k views

Pygame Drawing a Rectangle

I'm making a game that requires knowing how to draw a rectangle in Python (3.2). I have checked lot of sources but none show exactly how to do it.
user avatar
13 votes
7 answers
6k views

Toolkit Options for 2D Python Game Programming [closed]

What are some toolkits for developing 2D games in Python? An option that I have heard of is Pygame, but is there anything that has more range to do more things? What are the good and bad parts about ...
David Locke's user avatar
12 votes
1 answer
7k views

Disable key pressing events when they repeat

Is there any way to disable key pressing events when they are repeating? I'm developing a game and when I press a key, the players goes into running mode and goes back to standing mode when the key ...
Kanghu's user avatar
  • 581
9 votes
1 answer
2k views

Not understanding how the bitboard technique works for chess boards

My brain is smoking trying to understand the mechanics of this bitboard technique. In order to make it simple, lets imagine that, instead of chess and a lot of complex piece movements, we have a game ...
Duck's user avatar
  • 35.5k
9 votes
2 answers
6k views

The Fastest Way to Batch Calls in WebGL

I'm trying to rewrite my canvas-based rendering for my 2d game engine. I've made good progress and can render textures to the webgl context fine, complete with scaling, rotation and blending. But my ...
Abraham Walters's user avatar
9 votes
1 answer
30k views

Common usecase diagram for games

I developed a simple 2D puzzle game (like "bejeweled"). It can be played in two modes - "campaign" and "quick game". "Campaign" mode has several levels. Player can save his progress when quit a ...
Sprint Debugger's user avatar
8 votes
1 answer
15k views

Create a basic 2D platformer game in Unity

I know very little Unity and would like to create a platform 2D game very simple, just using the basic shapes (squares, rectangles, circles, etc.). I searched the internet and I found a more ...
user avatar
8 votes
1 answer
3k views

how to make Sprite follow bezier curve

Im fairly new to objective-c and sprite kit but i've done games development for a while. Im currently working on a 2d game and i have enemy ships moving from right to left on the screen. Ive been ...
Tony_89's user avatar
  • 807
7 votes
2 answers
56k views

setting a variable in local storage

Currently designing a game and the idea is that of a high score, so that when the current score is more than the local storage one it is replaced: localStorage.setItem('highScore', highScore); var ...
Lewis Waldron's user avatar
7 votes
2 answers
7k views

Creating a collision layer in Phaser using JSON and Tiled

I'm trying to create a platform game using Tiled to create my maps. I've made my map and exported it as a .json object. I can make the map appear in my game, but my sprite falls through my floor. I'...
Rokitar's user avatar
  • 211
7 votes
3 answers
4k views

AABB collision resolution slipping sides

So, I am currently reinventing the wheel (and learning a lot) by trying my hand at making a simple physics engine for my game engine. I have been searching the internet, trying (and failing) to fix my ...
Tim Eriksen's user avatar
7 votes
1 answer
2k views

How to find Resolution under Delphi XE5

I started to develop a game under Delphi XE5 for iOS. I have problem with the Resolution feature of the Firemonkey. When I open the screen and I check resolution on the iPhone I get 320x480. But the ...
Pavel Jiri Strnad's user avatar
6 votes
2 answers
28k views

Is it possible to develop 2D games in Android Studio?

I have searched in the web and found very few material on this question. I've heard of Unity 3D and know that there are other tools. But I would like to know if it is possible to develop games in ...
Marat's user avatar
  • 6,491
6 votes
2 answers
7k views

JavaFX Canvas Double Buffering

I am replicating a classic game, Pong, in Java using JavaFX. I am using java.util.Timer, java.util.TimerTask for the game loop and JavaFX's Canvas for rendering. Is there a way to add double buffering ...
silex's user avatar
  • 63
6 votes
2 answers
3k views

Detecting collisions between polygons and rectangles in Pygame

So I am trying to make an among us type game with pygame. I just started, so I don't have much of anything and am working on the map right now. However, one thing I'm struggling with is the collision ...
SundyAgo's user avatar
5 votes
10 answers
15k views

2D game development basics

I would like to write some simple Mario-like game from scratch using language C. But honestly I have no idea how to do so, and I can´t find any good tutorial for this, which is for free. But to the ...
B.Gen.Jack.O.Neill's user avatar
5 votes
2 answers
8k views

Does C++ has an equivalent of HTML <canvas></canvas> and JS fillRect?

Is there a way to draw figures in C++ like you do in HTML combined with JavaScript? By drawing figures I mean the <canvas></canvas> function in HTML and [canvas name].fillRect function. I'...
Recondito's user avatar
5 votes
3 answers
21k views

Unity3D - Shader for sprite clipping

I am trying to create a shader that can be used to clip 2D sprites in a game, I found this shader in another question Shader "Sprites/ClipArea" { Properties { _MainTex ("Base (RGB), Alpha (A)", ...
Khaled Abu AlKheir's user avatar
5 votes
1 answer
4k views

Is there any way to "commit" the state in Redux to free memory?

I'm working on a real-time multiplayer game and I use Redux on both the server and the client to store the state of the application. However, the amount of actions dispatched into the store is ...
Crisu83's user avatar
  • 93
5 votes
3 answers
2k views

How to get started with andengine [closed]

Are there any good resources to get started with Andengine? Any good tutorials, blogs or books? Of course, I have visited its official website http://www.andengine.org/, but I didn't think the ...
Waqar's user avatar
  • 263
5 votes
1 answer
1k views

Algorithm for finding an empty space that fits a rectangle that is closest to a target rectangle among other rectangles

Let's say you're placing rectangular tooltips on a screen of elements you want to provide information for. You want all these tooltips to be visible all at once and not cover any of the nodes any of ...
B T's user avatar
  • 59.4k
5 votes
2 answers
7k views

Using Phaser together with React

I am trying to understand how I could use React for rendering all the UI elements and Phaser for rendering a game (using Canvas or WebGL) within the React application. One way would be to use React's ...
Anastasis Skotidas's user avatar
5 votes
2 answers
663 views

Unity iOS Build Size Enormous but Textures Small

I'm building a unity game for the first time. When I build for iOS I get a full build size greater than 700mb but in my build report it says that the user assets are only 71mb. So what is the rest ...
maiamachine's user avatar
5 votes
0 answers
389 views

What is the Alternative for DirectionalShadowLight in LibGdx?

I Have a 3D Model with Animations in LibGdx. I Want to Create a Dynamic Shadow that Moves congruent with the Model. I researched how to and found a lot about DirectionalShadowLight, but it seems to ...
TAA's user avatar
  • 59
4 votes
2 answers
529 views

C / C++ - How to manage the cycles in a video game? [closed]

I have already made some video games in C (small personal project). And the problem I encountered every time is the same, how to manage the cycles in a game. For example, I coded a snake in SFML. I ...
Elfayer's user avatar
  • 4,451
4 votes
1 answer
2k views

Kaboom.js: how to set the background to an image

I'm making a kaboom.js game and I want to set the background of a scene to an image. I can only find solutions on changing the background to a colour. I hope someone can help!
Alex Wegrzyn's user avatar
4 votes
6 answers
5k views

Interview question: Create an object oriented design for Sudoku

I answered that I will have have a 2d Array. And then I will have 3 functions one to check the horizontal condition. another function to check vertical condition and another one the check the 3*3 ...
javaMan's user avatar
  • 6,512
4 votes
2 answers
844 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 ...
R-nold's user avatar
  • 242
4 votes
1 answer
2k views

How does delta_time work on python arcade?

I’m going through the tutorials on python arcade and would like to know how/why a function works. There is a function named on_draw(delta_time) I looked around the code for arcade but can’t figure ...
user1026169's user avatar
  • 5,595
4 votes
2 answers
3k views

SKAction scaleBy: duration: SpriteKit

I have a trouble trying to make one circle big and small using [SKAction scaleBy: duration:] SKAction *scaleDown = [SKAction scaleBy:0.2 duration:1.8]; SKAction *scaleUp= [scaleDown reversedAction];...
Alex Delgado's user avatar
4 votes
2 answers
8k views

Game/animation mockup/prototype tool [closed]

Advanced mockup/prototype tool that can be used for game/animation prototyping wanted. I need to add my images, then scale, rotate, screw, move them, and then get all the parameters: coordinates, ...
Maxim Lavrov's user avatar
4 votes
2 answers
455 views

2D rendering - algorithm to identify islands and apply "beaches"?

I'm playing with 2D games programming. My toy project is a sailing game with explorable islands and more, but at the moment I'm trying to find the best way to apply "beaches" (i.e. soft ends) to the ...
Leonard's user avatar
  • 3,082
4 votes
1 answer
182 views

How to penetrate or cut holes through a 2D foreground

I'm currently making a 2D game in Javascript, but I want to the game to have different lighting levels, for example, if I were to create a day and night cycle. However, I want to be able to cut holes ...
Scollier's user avatar
  • 615
4 votes
1 answer
3k views

Java: Using Swing for programming games

I am relatively new to game development. I have been developing games and studying game development for 2-3 months now. I use Java. I have always used Swing for my graphics (aka, the entire game is ...
Aviv Cohn's user avatar
  • 16.4k
4 votes
1 answer
530 views

Java Socket Server lagging with two clients

I'm new to StackOverflow lol, but I've been relying on this website for awhile. I have a question regarding a Java socket server that I created. Upon connection (client and server), my application ...
AlbertGeno's user avatar
4 votes
1 answer
72 views

Perform "catching up" when game is re-opened

What's a good way to handle "catching up" on all the actions that should have happened while a game was closed? Example: Tiny Towers. There are supplies, shops, customers: When a person closes the ...
bzle's user avatar
  • 43
4 votes
1 answer
3k views

LibGDX collision bounding Rectangle

I'm creating some rectangles surrounding my sprites for my player and bullet class to detect collisions with the overlaps method in Intersector class of LibGDX. I have a question: When I instantiate ...
magna_nz's user avatar
  • 1,253
4 votes
3 answers
2k views

Simultaneous keyboard input (diagonal game movement)

I'm working on a 2D game in Node where the character needs to move diagonally. This is a top-down, text-based game purely in a Node environment (no browser, so I don't have nice keydown/keyup events ...
Maros's user avatar
  • 1,903
4 votes
2 answers
1k views

C++ Snake clone: timer function ignores given stop time and stops at it's own fixed time

I'm trying to make a Snake clone using C++ and OpenGL/GLUT. However, I've been having trouble programming the short time intervals allowed for input between movements. I've tried a few timing methods, ...
user avatar
4 votes
1 answer
2k views

What is the easiest 2D game library to use with Scala?

I need to integrate a scala library for reinforcement learning that works on scala 2.9.1 with a 2D game library. If it uses SBT that would be awesome. I was looking at scage, however the current ...
placeybordeaux's user avatar
3 votes
1 answer
241 views

What are "&" and "|" used for in this color generation code?

Just stumbled upon the 2d game development video series on YouTube by designsbyzephy, and decided learning and understanding the code from the video will be my next Java learning venture. The biggest ...
GayLord's user avatar
  • 135
3 votes
2 answers
3k views

CardLayout in Java change by action in one of the 'cards'

I am making a simple game using a JFrame. I have made a simple "Start" screen which basically consists of a String and a JButton. I am picking up the button click with the actionPerformed(ActionEvent ...
imulsion's user avatar
  • 8,940
3 votes
3 answers
399 views

Game Data Structure in OCaml

I am currently working on a game / simulation of a computer like logistics system (like the minecraft mod applied energestics). The main part of the game is the 2d grid of blocks. All the blocks ...
Harold Fincher's user avatar
3 votes
3 answers
6k views

How to make an object move in the path of an arc?

I'm making a game where there should be a robot throwing ball-shaped objects at another robot. The balls thrown should fly in the shape of a symmetrical arc. Pretty sure the math-word for this is a ...
user3150201's user avatar
  • 1,931
3 votes
2 answers
2k views

Boundaries in Java Gaming, How do "professionals" do it?

How do professionals do boundaries in a 2D game? The way I do is say I don't want the sprite to move into a certain area: //Example if ((playerPosX >= 825) && (playerPosX <= 910)&&...
Exikle's user avatar
  • 1,165
3 votes
3 answers
1k views

Resize window and move contents within

I have a simple game I made in java. Essentially, my programming ability is relatively basic, and I would like to be able to resize the window the game is in and not have the images stay where they ...
M.Pagani's user avatar
  • 133
3 votes
2 answers
8k views

How do I detect triangle and rectangle intersection?

I am developing an Android game and I would like to know how to detect the collision of a rectangle knowing its position (x and y), width and height and a triangle knowing x,y, width and height. ...
Barbara PM's user avatar

1
2 3 4 5
23