2d-games

Slow Java2D Drawing on Integrated Graphics

北城余情 提交于 2019-12-20 06:30:58
问题 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

How to alert after all images loaded?

混江龙づ霸主 提交于 2019-12-19 04:07:37
问题 I'm building a JavaScript game and I want to alert after all images are loaded. I tried this code but it's not working: function loadEveryThing() { var imgNumber = 0; img1 = new Image(); img1.src = "1.png" img1.onload = function() { imgNumber = imgNumber + 1; } img2 = new Image(); img2.src = "2.png" img2.onload = function() { imgNumber = imgNumber + 1; } img3 = new Image(); img3.src = "3.png" img3.onload = function() { imgNumber = imgNumber + 1; } if (imgNumber == 3) alert("done") } 回答1: The

Android Gaming Frameworks

匆匆过客 提交于 2019-12-13 05:18:13
问题 I was considering creating a 2D game, and was wondering if there are any good open source or potentially paid (if not too expensive) frameworks for developing games. Anything out there already? Thanks. 回答1: AndEngine is for Android. libgdx is desktop/android framework. 回答2: Check out Unity, it's rather nice, though the terms are a bit expensive. 回答3: I have heard good things about Corona. http://www.anscamobile.com/ I have looked for a decent Android game framework and not been able to find

How to add new features to my Hangman game?

纵饮孤独 提交于 2019-12-13 04:36:34
问题 I am working on a game, Hangman. I have the code down, I just want to display the word if you lose. How can I do that? hangman's init()--by Londres on Stack Overflow script hangman property stdin : missing value property stdout : missing value property dict : missing value on init() --starting up the game set stdin to parent's hangmanStdin's alloc()'s init() set stdout to parent's hangmanStdout's alloc()'s init() set dict to parent's hangmanDictionary's alloc()'s init() my mainLoop() end init

Unity3D - Shader for sprite clipping

旧时模样 提交于 2019-12-12 12:01:30
问题 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)", 2D) = "white" {} _Length ("Length", Range(0.0, 1.0)) = 1.0 _Width ("Width", Range(0.0, 1.0)) = 0.5 } SubShader { LOD 200 Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" } Pass { Cull Off Lighting Off ZWrite Off Offset -1, -1 Fog { Mode Off } ColorMask RGB Blend

Android 2D Game With OpenGL

柔情痞子 提交于 2019-12-12 09:15:45
问题 Recently I worked on a 2D Game using SurfaceView and I learned a lot about game loops and everything. But now I want to make the same game using OpenGL. I read that the GLSurfaceView is the class that would be relative to what SurfaceView was. But I'm not sure about other things as: Using SurfaceView , I used the Bitmap class to load a image resource that would be lets say a character. And that bitmap would be a property of my Character class. And for the gameloop I used a different Thread I

Simple Battleships game implementation in Python

别说谁变了你拦得住时间么 提交于 2019-12-12 06:54:59
问题 Okay I'm not sure how to develop another board with hidden spaces for the computers ships per-se, and have it test for hits. Again I'm not even sure how I'm going to test for hits on the board I have now. Make note: The player turn function will be migrated to the computer board since you wouldn't be attacking your own ships. Here is the code. It may not be the best formatting (as in with Methods and objects and such) but I can polish it up a little later. Also would there be another way to

Good way to map custom-shaped HTML elements responsively for a board game

放肆的年华 提交于 2019-12-12 03:19:56
问题 My problem is that I haven't figure out how to align the spaces responsively. I've tried using vw/vh's and %s but both break consistency on different view sizes. Can anyone recommend a straight-forward way to lock down this board? I didn't want to use multiple canvas bc of the cpu drain of 50+ spaces and don't want to use an image map because that's not responsive. Hi guys and gals, I'm trying to port a board game into HTML via angular 1.x. I have an object with each board space, and have

Detect that SKShapedNode is closed

佐手、 提交于 2019-12-12 03:07:42
问题 In my future game(in SpriteKit), I need to draw circle-like shapes. I use CGMutablePathRef and SKShapeNode for drawing itself. On touchesEnded I need to check if the user did close the circle or if there is a gap between start and end touches. (Strictly saying, it can be not only the right circle, I need to detect any closed shape, e.g. loop...) How can I do this checking? 回答1: Store the touches locations (points) in an array: [yourArray addObject:[NSValue valueWithCGPoint:yourPoint]]; Make a

How can I relatively scale something between two points?

浪尽此生 提交于 2019-12-12 00:36:52
问题 This is more of a math question, and I couldn't seem to find any answers online. So here is what I am trying to accomplish: Lets say I have a circle, starting at Ay . Now as this circle moves towards By , I want it to scale proportionally to a certain size. So for example, if the circle's diameter was 5 at Ay , how could I scale it to become 52.2 by the time it reaches By . And bonus question: could I achieve this same thing with a square? 回答1: Tweening in terms of position. Keys and