Categories
Game Creation Mastering Development

Trying to create a knockback effect between 2 squares (Code in Java)

I’ve been in trouble for weeks now and I don’t understand why it doesn’t work for me! I have tried so many things and I just can not understand. I try to get one player to get a knockback as soon as another player collide with him. But for some reason the result of this […]

Categories
Mastering Development

Trying to add horizontal movement to my game in love2d

I have tried to add horizontal movement into my game in love, but I haven’t found a way yet. This is my code. PADDLE_SPEED = 200 player1 = Paddle(10, 30, 5, 20) player1 = Paddle(10, 30, 5, 20) player2 = Paddle(VIRTUAL_WIDTH – 15, VIRTUAL_HEIGHT – 30, 5, 20) player3 = Paddle(30, 10, 20, 5) player4 […]

Categories
Mastering Development

Having css property in variable in react hooks

I need to remove some properties of html element and add some extra property based on some event. I am trying to achieve this by creating one object variable for required css properties and trying to change it at runtime by assigning new object value to css variable. Here is the sample code: const MyCssVariableSample […]

Categories
Mastering Development

using imported object returns “undefined”

in main.js file, I do the following- import Maze from "./mazeContainer.js"; let MyMaze; …. initiate(); …. function initiate() { MyMaze = new Maze(Ctx, Width, Height, CustomGrid[0].value, CustomGrid[1].value); MyMaze.setup(); listenMoves(); } …. export default MyMaze.player; Setting up MyMaze results in- …. this.player = new Player(); this.player.setPlayer(); …. And then in move-detection.js– import Player from "./main.js"; Before […]

Categories
Mastering Development

How to replace deprecated function RectangularNode in AnyLogic?

I am trying to run an AnyLogic model developed a few years ago and I do not have access to the person who coded it. I have very limited knowledge of Java. The model is built based on data being read in from an XML file. The first step is to read the layout data […]

Categories
Mastering Development

Modern OpenGL Black Screen with shader program and no errors

I have no errors but when I run the program all I have is a black screen and I am supposed to have two triangles: #include <iostream> //includes C++ i/o stream #include <GL/glew.h> //includes glew header #include <GL/freeglut.h> //includes freeglut header using namespace std; //Uses the standard namespace #define WINDOW_TITLE "3-1 Assignment" //Macro for window […]

Categories
Game Creation Mastering Development

Getting Rendered Sprite Size

I need the rendered dimensions of a sprite, I’m calling Draw in the class below: public class Ship { public Ship(Texture2D texture) { Width = texture.Width; Height = texture.Height; Texture = texture; } public int Width { get; set; } public int Height { get; set; } public float Scale { get; set; } public […]

Categories
Mastering Development

how to resize an image while maintaining width and height ratio

I am using this function to resize an uploaded image: function imageResize($imageResourceId,$width,$height) { $targetWidth =750; $targetHeight =300; $targetLayer = imagecreatetruecolor($targetWidth,$targetHeight); imagecopyresampled($targetLayer,$imageResourceId,0,0,0,0,$targetWidth,$targetHeight, $width,$height); return $targetLayer; } But this makes the image 750 width and 300 height. The height should be flexible and depends on the width. So i am looking for something like this: $targetWidth = […]

Categories
Mastering Development

How To Combine Cube Code and Camera Code in OPENGL

Hi I’m not sure how to do this and I want your help. I want to know how should I combine the cube code and the camera code so that it can show a cube that has a ground because I want to animate an arm and grab the cube on a table, and move […]

Categories
Game Creation Mastering Development

How Do I draw My Particles When Enemy is Killed? pygmae

so I have enemys that move left and right I was wonder how I could make my particles load up when the enemy is killed? here is my particle class class explode: def __init__(self,x,y,height,width,color): self.x = x self.y = y self.height = height self.width = width self.explode = [ pygame.image.load("spark_01.png"), pygame.image.load("spark_02.png"), pygame.image.load("spark_03.png"), pygame.image.load("spark_04.png"), pygame.image.load("spark_05.png"), pygame.image.load("spark_06.png"), […]