2d-games

High score and current score

回眸只為那壹抹淺笑 提交于 2019-12-25 02:06:51
问题 I want to show on the screen the current score of the gameplay and the storical best score. It is work, but every times i restart the game the best score change even if the current score is lower than the best score. CCLabelTTF *punteggio; NSString *stringa; NSString *stringa2; CCLabelTTF *punteggioMAX; int score; int scoreMAX; There are the methods to SAVE the score, to add the score and to reset the score at the end of the game. -(void)aum{ score++; stringa = [NSString stringWithFormat:@

The light component is behind Image in Unity

∥☆過路亽.° 提交于 2019-12-24 23:15:23
问题 I have two different canvases: one for the background and one for the game scene Principal canvas: Background canvas: I'm having this problem: If I put an object in the principal canvas, everything seems to works but If I add a light component to this object, I'll not see the light (it is like the background image is ahead the light): Without the background canvas: With the background canvas: Any idea why? (The problem is not the BGcanvas, the problem is the image component of the BGcanvas,

Build a grid level for a game with SpriteKit and SWIFT

本秂侑毒 提交于 2019-12-24 16:13:06
问题 I’m searching the best way to build the levels for a game : The game will be composed with many levels, each levels will be unique. You’ll play an object (here the star), which is in movement on a grid. The object can move only to the bottom, it cannot go back. A level is composed with many cases, each cases will have a different behavior. My level will have a background, width of the screen, but the height will depend on the level, I suppose many times the height of the screen. The

Resize window and move contents within

不问归期 提交于 2019-12-23 17:00:47
问题 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 are and just display whiteness in the larger area. Here's a Screenshot. Is there any simple way to do this? 回答1: The two existing answers seem to presume you wish for the game space to resize. Resize the game space A game space that is a shoot'em'up does not necessarily resize well. E.G. When the

The new cocos2d has not got CCRibbon?

此生再无相见时 提交于 2019-12-23 04:24:23
问题 I recently downloaded the new cocos2d (I still have the older one) and I have been using a ribbon from CCRibbon to make a bullet move but it does not exist anymore and in a lot of my games it is a key object, can I somehow put it back in or use a similar "drawing" object? Thanks. 来源: https://stackoverflow.com/questions/12588470/the-new-cocos2d-has-not-got-ccribbon

Slow map in java

心已入冬 提交于 2019-12-23 01:13:50
问题 I'm making a game in java, is a rpg, however, only with the map the game is slow. The map is made ​​in TiledMap Editor, therefore, an XML that is read and loaded into an ArrayList. My PC is a dual-core 3.0, 4GB RAM, 1GB Video. The do the rendering is done as follows: //method of tileset class public void loadTileset(){ positions = new int[1 + tilesX * tilesY][2]; int yy = 0; int xx = 0; int index = 0; // save the initial x and y point of each tile in an array named positions // positions

JavaFX Canvas Double Buffering

☆樱花仙子☆ 提交于 2019-12-22 12:19:12
问题 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 to the Canvas so the animation doesn't flicker? Or should I approach this differently? Bellow is the code. I removed some parts of it, that I think are irrelevant, since the code is around 200 lines long. Canvas canvas = new Canvas(stageW, stageH); GraphicsContext gc; public void start(Stage

Shoot from rotating body

前提是你 提交于 2019-12-22 10:36:15
问题 I have a rotating enemy body that shoots bullets. It's working pretty good, but it appears to fire in all directions except straight down. It's been a while since I took trig, and I think I'm forgetting something. Do I have to check the rotation of the enemy? SKAction *shoot = [SKAction moveTo:CGPointMake(2000*cosf(enemy.zRotation),2000*sinf(enemy.zRotation)) duration:5]; SKAction *remove = [SKAction removeFromParent]; [bullet runAction:[SKAction sequence:@[shoot,remove]]]; 回答1: Here is some

Java: Using Swing for programming games

一笑奈何 提交于 2019-12-21 17:28:11
问题 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 displayed on a JPanel , using a Graphics2D object). I had no trouble with this up until now. Very recently, I came across a problem in my most recent project. Some method has problems with being called in consistent time intervals (sometimes it runs every 15-16 milliseconds, as it should, and

Slow Java2D Drawing on Integrated Graphics

China☆狼群 提交于 2019-12-20 06:31:33
问题 I'm working on a simple 2D game, rendering via the Java2D API. I've noticed that when I try to draw on integrated graphics card the performance crashes. I've tested this game on both my main rig with a newer ATI Radeon and my 5 year old laptop which also has an (incredibly antiquated) Radeon. On both I get good FPS, but when I try to use my Intel i5's onboard HD 4000 graphics, it crawls at around 20 FPS. I'm using Full Screen Exclusive mode. At any given moment, I am rendering approximately