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.

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, but not a z coordinate unlike in 3D games.

This can range from top-down games, like dwarf fortress, to side-scrolling ones, like platformers. It would refer to any games where the character / objects can move freely in two dimensions (e.g. left-right & up-down).

Related tags:

Remember there is also a special StackExchange site: Game Development

1116 questions
3
votes
2 answers

SDL2 function to draw a filled circle

I am looking for a function that draws a filled circle using SDL2 without using a renderer at all. I currently have this: void Circle(int center_x, int center_y, int radius, SDL_Color color) { eraseOldCircle(); uint32_t *pixels = (uint32_t *)…
3
votes
1 answer

Transparent background not disappearing when displayed on pygame window

I am creating a car game and have come across a problem. I've added a car image with a transparent background into my code but the car appears on the screen with the transparent background visible. I want to make the background to disappear. This is…
3
votes
2 answers

How can I stop enemies from overlapping pygame

I'm trying to find a way to have enemies track the player in my 2d game (pygame) but not clump up Currently, when I shoot at them, the bullet collides into and damages all of the enemies that are clumped. I would like it to be a hoard but spread out…
Ryan
  • 47
  • 1
  • 6
3
votes
1 answer

Reveal left over underscores one at a time at end of Hangman TypeScript game

When the game is over, I am trying to replace the underscores with the letters they missed one at a time using a setTimeout. This function swaps the underscore with the correct letter but, on the following render puts the letter back to the…
3
votes
2 answers

How would I fix pygame's key press event not doing anything?

I'm setting up this class that has the purpose of setting up the character and drawing them on to the game. The key press is in another loop inside a function. Now while I do have the sprites I'm having difficulties using those sprites whenever I…
Thanos
  • 386
  • 2
  • 13
3
votes
0 answers

Detecting collision of two grid-like objects in 2D space

Let's assume we have two objects, A and B. What we know about them is their center points' coords (x, y which are floats) and a map (a string of one-zeros - objects' heights are always equal to its width), that tell us which areas of an object can…
3
votes
1 answer

Limiting 2D camera movement in Unity to edge of my map

Link to Image I managed to calculate the edges of my map but now I need to make it so that the edges of my camera do not exceed the edges of my map. my code looks like this: using UnityEngine; public class CameraMovement : MonoBehaviour { public…
user10231058
  • 111
  • 2
  • 10
3
votes
3 answers

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 have common properties like a position. But then there…
3
votes
2 answers

Unity Standard assets Cross Platform input not working

I imported Unity Standard Assets cross platform input successfully In imported cross Platfrom script UnityStandardAssets.CrossCrossPlatformInput is working perfectly but when i use it in CharacterController2D script that not respoonding shows…
SHAH MD IMRAN HOSSAIN
  • 2,558
  • 2
  • 25
  • 44
3
votes
2 answers

java game how to construct timed effect/fixed distance effect?

I am writing a java game in javafx, but I think the solution to this question isn't unique to javafx... I have a Entity class and a bunch of its subclasses such as Missiles, Lasers, etc. However, when the Missiles and Lasers are created by…
Ptolemorphism
  • 101
  • 2
  • 11
3
votes
2 answers

How to create image of SKSpriteNode?

I have a SKSpriteNode with a lot of child nodes. I use that node with all the children very frequently in my game. A better approach would be to build this node once with all the children, create an image (SKTexture) and use the created texture, as…
3
votes
2 answers

SpriteKit Lots of Nodes from Same Image: Load Separately or Duplicate?

I'm programming a game in SpriteKit and am coding a section where the "level" is loaded in from a text file, placing a wall node in every spot marked by an "x" in the text file. However, if I know that there are going to be a lot of nodes, and…
jaxreiff
  • 503
  • 1
  • 4
  • 14
3
votes
1 answer

React Native Sprite Sheets

Is it possible to do sprite sheet based animation with React Native? It appears that you have to load individual images, rather than a sprite sheet.
Hamicorn Fury
  • 751
  • 6
  • 8
3
votes
2 answers

Simple combo multiplier in sprite-kit

I am making a reaction game, where you can destroy enemys and earn points. Now I would like to have combo points if you destroy them fast and if there is a specific time gap the combo multiplier should go to zero again. I would like to multiple the…
ccdev
  • 87
  • 6
3
votes
1 answer

How to get name of the object's from a different class in Java

I am using Greenfoot IDE and i have a World Class and a Boat class and a Exit class Inside the Boat class i have a constructor which defines the boat (what kinda boat it is & which picture). Boat Code: public class Boat extends Actor { private…
user4095898