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.
1,117
questions
0
votes
0
answers
59
views
How to rotate a CGRect in Swift UI to detect collisions
Im working on this game where you have an airplane and there's falling balls from the sky. So to check for collisions between the airplane and the balls I created rectangles to represent their hitbox.
...
1
vote
0
answers
19
views
Unity 2D platform Player position scene transition
I am making a platform game in unity. I am quite new to scripting like 1-2 years now. I usually can read the code and understand it with and sometimes without tutor too. But basically I am not good at ...
0
votes
0
answers
29
views
Java 2D Animation, why doesn't currentFrame get updated every time the game ticks?
I have been working on this game for quite a bit now. I looked through some of the game loops and animation systems online. After I felt confident about coding my own animation system, I came up with ...
0
votes
2
answers
78
views
Ligths out game with house trying to write function that writes "#" in correct windows [closed]
char house =
" ______________ "
" |______________| "
&...
0
votes
0
answers
13
views
How do i make the composite collider sit slightly inside the actual objects/sprites
I have made a tilemap thas full off grass, i want the player to walk in the grass instead of on it. But when i use the composite collider it selects everything, including the grass making my player ...
0
votes
1
answer
27
views
Double collision of prefab in Unity
I would like that when two spheres (prefab) meet they disappear and form a square, but 2 are formed
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class circle :...
0
votes
1
answer
60
views
Do large amount of scenes cause performance issues in unity?
I am making a pixel art puzzle platformer game in unity.
I had the idea to make 4 chapters with 50 levels each and some bonus levels for paid version, so about 250 levels.
Now as i never worked with ...
0
votes
0
answers
165
views
Achieving Pixel-Perfect Display in Unity 2D Game with 32x32 Pixel Art Animations
I am relatively new to game development and currently working on a 2D project in Unity using C# with pixel art animations (32x32px sprites). Despite setting up the project with specific configurations,...
1
vote
1
answer
39
views
CSFML - Toggle input issue
So I'm trying to make an entire game on my own, and I got into the part where I make an inventory. I want to make a toggle input on the key E to open the inventory, but when I try in-game the feature, ...
0
votes
0
answers
37
views
JS Function to resolve collision between circle and rectangle
I'm making a top down 2D game, with circles for players. I've been trying to write a function to take in details about a collision after it has been detected (and before it has been rendered) to get ...
0
votes
0
answers
86
views
Unity - Transparency Sort Mode not working properly with Tilemap
I hope you're all doing great! I'm reaching out to the community today because I've run into a bit of a snag with setting up the Transparency Sort Mode in Unity, and I'm hoping someone here might be ...
0
votes
1
answer
57
views
Can't call Invoke
I've been struggling with this problem for hours and still can't figure it out so can anyone help me with this?
My invoke method is not doing anything. here's my code:
void Update()
{
...
0
votes
0
answers
45
views
I'm working on chess game using Flutter, i have some difficulties creating a Function to see the valid moves for one of the pieces
I created a grid view and placed all the pieces that I wanted. Then, I moved on to create a function to calculate the valid moves for each piece. I completed most of the function, but I encountered a ...
0
votes
0
answers
50
views
two animations at same time for one character without an avatar mask in unity 2d?
I have frame by frame arms/hand attack and body jump in png sequence from my After Effects projects, and want to display it when jump and attack, like the body doing the jump animation the arms/hands ...
0
votes
0
answers
38
views
How to load and draw a .png file?
I have multiple sprite sheets for the game, but I can't add the .png file properly into the code. It's seem to be working but it throws some errors every once in a while. And the attack animation ...
0
votes
0
answers
294
views
How to use Polygon2D node in Godot to create a regular polygon?
I am new to Godot and I want to create a regular polygon shape.
I don't quite get how Polygon2D node works.
I generated a list of points in the script of the node and passed it as the value of the ...
0
votes
0
answers
32
views
JavaScript 2d game objects collision
I'm currently learning JavaScript and I have a project to make a 2d rogue like game but I'm kind of stuck right now.
I created the room layout based on a map string with the following code:
import ...
0
votes
1
answer
78
views
Script to generate an image on a tilemap
I am new to game development. I wanted to do a simple project, where upon clicking a button causes an image to be generated on a particular tile. I have created my 2D tilemap and buttons, but not very ...
0
votes
1
answer
42
views
Roblox PONG Collision And Direction Not Working
I'm making a PONG game in Roblox, but it seems the ball keeps going to The bottom left, and sometimes the bottom right of the screen, the problem with this - is that its supposed to fly left or right, ...
0
votes
0
answers
28
views
key listener is not responding
public class Main {
public static void main(String[] args){
var gameWindow = new GameWindow();
var gamePanel = new GamePanel();
gamePanel.startGameThread();
}
}
...
-1
votes
1
answer
58
views
how to limit character to jump only above floor , not on its side area
How to prevent my character stop jumping while colliding with my gameobject tag as a floor. I just want my floor to be used on jumping when my character is above it , not on its side part.
so I have ...
1
vote
1
answer
82
views
How to make the player jump to the Y axis
so I have a player that I can tilt with a slider. So the more you pull the slider to the right, the more he will rotate to the right till he reaches the limit of 50 degrees, and the same thing for ...
0
votes
1
answer
37
views
I'm having a bit of trouble making the two buttons I've made into actually clickable buttons
What I have is just the start screen, As long as I can get the Quit button working I can probably figure out the rest on my own. I just need the Quit button to close the window and stop the program. y'...
-1
votes
1
answer
260
views
adding number of enemies on godot version 3.5
so I have been developing a basic game in Godot (I am a beginner) I have an enemy scene and a level scene I want to add a lot of enemies to my level scene one way to do that is to attach the enemy ...
-2
votes
1
answer
47
views
Why Am I Going Through the Ground in Unity Game Engine?
I am going through the Ground in my Unity Game Engine. Does anyone know why I am going through the ground. I am following the tutorial: https://www.youtube.com/watch?v=LEUhxe9vUOM&list=...
0
votes
0
answers
29
views
Moving gameobjects with offset with finger
im currently developing a 2d mobile game with unity and i am still a begginner, so i need help with this one feature for my game.
What im trying to make is a dude on a pogo stick jumping automatically ...
0
votes
0
answers
93
views
Trying to recreate Space Invaders in Java and I don't understand how to make my Start Button work
I followed a guide to make the space invaders game application but i also have a main menu that i created. I know how to make buttons switch FXML files but the application with the game has no clear ...
0
votes
0
answers
40
views
How to fast rearrange tilemap in Unity
In Unity, I downloaded a tilesheet, but textures are not arranged correct.
I want to move them, but the only way I found to do this is, firstly selecting them, them swapping to move tool, one by one.
...
-4
votes
1
answer
128
views
Tic Tac Toe JS game [closed]
I don't know exactly what is wrong in cod, can you help me find it?
What I know is that 'available' array is not correctly emptying and computer sometimes plays two moves in row.
link to code on ...
0
votes
0
answers
190
views
Basic jump issue in Godot engine
Hello all and sorry if the question is too basic.
I'm trying to create a basic jump. The point is that it works fine when y press jump + lateral mov, but it goes to the top and beyond when I press ...
0
votes
1
answer
36
views
Sprite in Pygame moving up and down in a endless loop
I don't know much about pygame so I just copied a tutorial on pygame.org and the sprite just spins up and down in a loop.
import sys, pygame
pygame.init()
size = width, height = 500, 500
speed = [2, ...
1
vote
0
answers
30
views
How to move paddle in 2d Breakout Game by touch [closed]
I am making a 2d breakout game in Javascript which will work on laptop and mobile both but I want help in moving paddle in Breakout game by touch.
let leftPressed = false;
let rightPressed = false;
//...
0
votes
1
answer
206
views
How to check if two rectangles overlap in SDL2?
I am creating a game using SDL2 which creates 200 objects of a class Star and prints onto the screen all 200 as 2px x 2px rects in random locations. I created a player class which creates a 10px x ...
0
votes
2
answers
83
views
GODOT set of attack movements
As you can see in many games, when your characters perform multiple attack moves just by simple clicks. For example, first click is normal attack, second click (right after first click) is still ...
0
votes
0
answers
29
views
A 2d Fighting game on visual studio using iGraphics, Cannot add images on string to show movement
I want to make a game in visual studio using C++ language and iGraphics. I have to move a character using a string. But I am facing problem using iShowImage().I take a String of some png file. When I ...
1
vote
0
answers
112
views
How can i simulate a multilevel map in a phaser 3 scene?
I'm creating a 2d game with a top-down based camera and i was trying to make a map with more than 1 level. I'm getting a lot of problems when the player has to pass from one level to another.
At the ...
0
votes
1
answer
196
views
Can't switch from any state to running state (Unity)
I'm learning how to create a simple 2D platformer in Unity. I've been following a tutorial from a youtuber called "Coding in Flow". I've set up all the animations correctly (idle, running, ...
0
votes
1
answer
63
views
how to change bitmap image width and height in createjs
I have created a game in createjs. For images I am using bitmap to load them. I am able to give them positioning in my grid. I'm trying to change its width and height but its not working.
// this is ...
-1
votes
1
answer
244
views
How to use pathfinding on a map image in unity 2d?
In my 2d android game, I have an image of a map as the background. I want to spawn objects and make them walk to a given destination. However, I want them to walk on the actual roads. I tried to use ...
0
votes
0
answers
46
views
Pygame problem when loading game from file and trying to redraw it and play
When Ever I save the game it works but when loading the contents back it will load game correctly as long as i am on exact same round but if i load the game and i am on a different row/round to what ...
1
vote
0
answers
60
views
Rendering particles inside HTML 5 Canvas
I am learing gamedev using HTML 5 Canvas and while writing my second game I got strange problem.
Long story short: I create particles based on enemy size when projectile and enemy collide and than I ...
1
vote
1
answer
311
views
PixiJS Fixed-step loop - Stutter / Jitter
I've been facing a strange issue beyond my understanding of how to fix it.
I'm trying to create the following multiplayer game structure:
The server running at 20-30 fps
The client logic loop at the ...
0
votes
1
answer
114
views
movement repeat in 2d game by opengl
When the red car is moving, it is repeated with every movement and at every chance has repeated, I had searched but not found a solution, so what is the solution to the problem?
#include <GL\glut.h&...
0
votes
0
answers
30
views
Omit/Skip images on export - TexturePacker
I'm an animator by trade, so this is new ground for me. Hope someone can help ;-)
I am using an app called TexturePacker to pack an image sequence of about 100 pngs into a texture sheet to be used in ...
0
votes
2
answers
47
views
How can I make it so that only one of the draggable objects in my game can be moved at a time?
So I'm trying to make it so that when I press "a" a square gets created on the cursor's position, and I can drag these squares around with left mouse button. The problem is that when I'm ...
0
votes
1
answer
72
views
How to move 2D multiple drawn shapes (Squares and Rectanagles) seperately in OpenGl?
I have just started using OpenGl in visual studio.
I used the drawsquare() and drawRoundRect () to draw multiple shapes in seperate void functions which I called seperately in an another function ...
0
votes
1
answer
85
views
Calculate coordinate on a line knowing the start, end, and length of the line?
I'm developing a 2d game in JS and stuck on a trigonometry problem.
Problem: Player shoots a target. The shot is blocked by an obstacle. The obstacle is between the player and the target. I need to ...
0
votes
1
answer
251
views
Touch moviment in godot
I'm not able with any youtube tutorial and blogs to make a joystick movement for my topdown 2d game on godot
as I said, follow step by step several tutorials on the internet / youtube and I couldn't ...
0
votes
1
answer
600
views
Steering Wheel code in Unity Engine using C#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
public class SteeringWheel : MonoBehaviour, IDragHandler, ...
0
votes
1
answer
83
views
collision prediction in HTML5 canvas game
I am creating a minigame in HTML5 with canvas.
The problem I am facing now is that I have implemented a collision function, which is called "circleCollidesWithRectangle". This function ...