game-engine

Investigation of optimal sleep time calculation in game loop

自作多情 提交于 2020-01-09 09:02:20
问题 When programming animations and little games I've come to know the incredible importance of Thread.sleep(n); I rely on this method to tell the operating system when my application won't need any CPU, and using this making my program progress in a predictable speed. My problem is that the JRE uses different methods of implementation of this functionality on different operating systems. On UNIX-based (or influenced) OS:es such as Ubuntu and OS X, the underlying JRE implementation uses a well

Angrybots Environment Floors

荒凉一梦 提交于 2020-01-06 07:31:10
问题 Have your ever payed attention to the environment floor's texture of the angry bots demo which comes with unity3D ? here is the texture : (why this atlas texture looks like this with less alpha ? ) This Texture name is EnvironmentFloorTiles_A and I Wonder how they have created this and why they had to this ? I had opened this in a new standard material in 3DS max and applied this to a plane with UV's modified , by a miracle it was mapped on the plane as a chromatic texture. Perhaps there is a

Display the score in unity

人走茶凉 提交于 2020-01-05 13:09:00
问题 I am completely new to unity. I am making a simple 2d platformer game using unity. Can somebody help me to display the score on the game. I am storing the value on a int variable. Below is the c# code i used for the distance covered. using UnityEngine; using System.Collections; public class distanc : MonoBehaviour { private int dist; // Use this for initialization void Awake () { dist = 0; } // Update is called once per frame void Update () { dist = dist+=1 * Time.deltaTime; print("Dist:" +

How does this implementation of operator[] function work?

浪子不回头ぞ 提交于 2020-01-05 04:58:31
问题 I am working through a book (Foundations Of Game Engine Development By Eric Lengyel) and the book is writing out some vector operations in c++, here is the snippet: struct Vector3D { float x, y, z; Vector3D() = default; Vector3D(float a, float b, float c) { x = a; y = b; z = c; } float& operator [](int i) { return((&x)[i]); } }; im particularly concerned with this piece: float& operator [](int i) { return((&x)[i]); } Now I would expect this code to return x, no matter what index is entered.

How can I catch 2+ key presses at once?

你离开我真会死。 提交于 2020-01-03 17:32:51
问题 Well lately i got interested in creating JS games. (not an area i have experience with but it interests me). i know there are several gaming engines for JS out there but i dont really want to create a game. rather i am curious on how things work / how can i create one. I have several questions: Anyone with suggestions on where can I read about it? Prerequisite (what knowledge is needed). I tried making a small game of something walking in a rectangular. By binding keyup to the window and

How can I catch 2+ key presses at once?

房东的猫 提交于 2020-01-03 17:32:05
问题 Well lately i got interested in creating JS games. (not an area i have experience with but it interests me). i know there are several gaming engines for JS out there but i dont really want to create a game. rather i am curious on how things work / how can i create one. I have several questions: Anyone with suggestions on where can I read about it? Prerequisite (what knowledge is needed). I tried making a small game of something walking in a rectangular. By binding keyup to the window and

Drag physic object in corona sdk

白昼怎懂夜的黑 提交于 2020-01-02 06:11:13
问题 I'm try to drag a dynamic body with gravity = 0,0 in my scene, I have a square with body type dynamic, and an image with body type static, but when drag the square over the image this have a little force but can exceed the image and pass to the other side like the images: This is my code to drag the square: local function dragBody( event ) local body = event.target local phase = event.phase local stage = display.getCurrentStage() if "began" == phase then stage:setFocus( body, event.id ) body

Ruby sandboxing vs. integrating a scripting language

本小妞迷上赌 提交于 2019-12-31 21:46:07
问题 I am currently working on a text-based game engine in Ruby, with the app separated into Ruby code in /lib and YAML data in /data, which is loaded when needed by the game. I want to allow the data files to contain basic scripts, mostly in an event/observer model. However, I also want users to be able to generate and share custom scenarios without having to worry about malicious code embedded in the script. Addendum: My original plan was to have user-created content separated into two types,

LibGDX: Filtering a scaled TextureRegion

北城余情 提交于 2019-12-30 08:25:36
问题 I have several objects with different textures for different states, so I am using a TextureAtlas made with TexturePacker, and resizing the TextureRegion where I need it. I have to resize because not only am I trying to support both 720p and 1080p, but some of my objects are tiles or cursors which resize based on the width and height of the board, as that can change in my game whereas the board will always occupy the same percentage of the screen. With a Texture , I can just do this: texture

Cocos2D OR libgdx for Android Game Development [closed]

允我心安 提交于 2019-12-29 07:28:28
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I just want to know, that in the long run, using which of these engines will be better. Although I feel that using Cocos2D will be a