2d-games

How to make object move in js?

一个人想着一个人 提交于 2019-12-07 23:20:28
问题 I'm trying to learn object oriented programming in javascript so I try to make a simple game. I would like to make a character that moves. There is the code in js: function move(event) { var k=event.keyCode; var chr = { updown : function (){ var y=0; if (k==38) {--y; }else if (k==40) {++y;} return y; }, leftright : function (){ var x=0; if (k==37) {--x; }else if (k==39) {++x;} return x; } }; chrId.style.top = (chr.updown())+"px"; chrId.style.left = (chr.leftright())+"px"; } html: <!DOCTYPE

setting a variable in local storage

可紊 提交于 2019-12-07 05:53:56
问题 Currently designing a game and the idea is that of a high score, so that when the current score is more than the local storage one it is replaced: localStorage.setItem('highScore', highScore); var HighScore = localStorage.getItem('highScore'); if (HighScore == null || HighScore == "null") { HighScore = 0; } if (user.points > HighScore) { highScore = parseInt(HighScore); } return highScore Thanks guys 回答1: This should point you in the correct direction. // Get Item from LocalStorage or

Slow map in java

穿精又带淫゛_ 提交于 2019-12-06 16:44:09
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[tileNumber] [0] - X position // positions[tileNumber] [1] - Y position for(int i = 1 ; i < positions.length

Web-based Multiplayer Board/Card game toolkit

喜欢而已 提交于 2019-12-06 15:24:55
问题 As a personal hobby, I would like to program a web-based card game with a few tokens and write an AI for it. I do not want to spend time and effort on standard elements such as maintaining a list of games and coordinating who's playing who, or even writing a login system (ideally I'd like to use Google accounts). My choice of programming language is flexible, but would prefer something I could run on Google app engine. I know Google Play Games provides some of the APIs but I was hoping for

What would be a typical game skeleton in Haskell [closed]

孤街醉人 提交于 2019-12-06 14:41:08
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . What would be the typical game skeleton for a Haskell game, let's say a simple shoot them up for instance? I am particularly interested on the data structure, and how to manage the update of all the elements in the world, in regards of immutability issue. Just saying that new

JavaFX Canvas Double Buffering

早过忘川 提交于 2019-12-06 11:23:36
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 stage) throws Exception { Group root = new Group(); gc = canvas.getGraphicsContext2D(); Timer loop = new

How to make object move in js?

我是研究僧i 提交于 2019-12-06 08:11:31
I'm trying to learn object oriented programming in javascript so I try to make a simple game. I would like to make a character that moves. There is the code in js: function move(event) { var k=event.keyCode; var chr = { updown : function (){ var y=0; if (k==38) {--y; }else if (k==40) {++y;} return y; }, leftright : function (){ var x=0; if (k==37) {--x; }else if (k==39) {++x;} return x; } }; chrId.style.top = (chr.updown())+"px"; chrId.style.left = (chr.leftright())+"px"; } html: <!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="jumpOPP.css"> <script src="jumpOPP.js"><

How to find Resolution under Delphi XE5

纵然是瞬间 提交于 2019-12-05 23:33:02
问题 I started to develop a game under Delphi XE5 for iOS. I have problem with the Resolution feature of the Firemonkey. When I open the screen and I check resolution on the iPhone I get 320x480. But the native resolution of the iPhone 4 and 5 is doubled. I found at official Delphi pages that FireMonkey is recalculating the screen by "Resolution" which is for Retina display 2. I think this is cool feature for regular apps, but when you start to do game and you want to manipulate with images by

Web-based Multiplayer Board/Card game toolkit

不打扰是莪最后的温柔 提交于 2019-12-04 21:24:40
As a personal hobby, I would like to program a web-based card game with a few tokens and write an AI for it. I do not want to spend time and effort on standard elements such as maintaining a list of games and coordinating who's playing who, or even writing a login system (ideally I'd like to use Google accounts). My choice of programming language is flexible, but would prefer something I could run on Google app engine. I know Google Play Games provides some of the APIs but I was hoping for something more comprehensive. Even better if it works with Google Play Games. Can you recommend toolkits

What would be a typical game skeleton in Haskell [closed]

可紊 提交于 2019-12-04 19:40:44
What would be the typical game skeleton for a Haskell game, let's say a simple shoot them up for instance? I am particularly interested on the data structure, and how to manage the update of all the elements in the world, in regards of immutability issue. Just saying that new_world=update_world(world) is a little bit simplistic. For instance, how to deal with multiple interaction that can occurs between element of the world (collisions, reaction to player, etc....) especially when you have a lot of 'independent' elements impacted. The main concern is about immutability of the world, which