29

You can't. At least, not as a game developer. As a gamer, you can purchase more expensive keyboards with "anti-ghosting" features, but otherwise the limitation is part of the hardware itself, so there's nothing you can do in software to solve it. Check out this demo page to see how keyboard ghosting works, plus a demo: https://web.archive.org/web/...


21

In various Super Mario games, it's called a pit, abyss or bottomless pit. Bottomless Pit is also a TV trope.


14

You should definelty use multiple smaller images. However, smaller images doesn't necessarily means something like this: (source: refrag.com) You can just have few map parts that fit together nicely. When the player arrives in a new zone you check the collision for this new part. For example you have tiles like this (they can/should be larger): 1 ...


14

Camera matrix transformations are easy Creating a basic camera is easy. Below will get you started with the basics. Moving it around, rotating, ans scaling. Moving every 2d sprite isn't much of an issues but if you factor in either scaling or rotation then it gets really hard to apply to every sprite individually. class Camera2D { public float Zoom { ...


12

I'll answer with an autobiography. Projector sheets You know those ancient projectors that come with transparent sheets? In primary school, I discovered you could draw a character's torso on one transparent sheet... ... and then take out another sheet, lay it on top, and draw arm with a gun on it ... ... and then rotate the top sheet with the arm on it (...


9

Disclaimer: If you want to expand the road with more complex imagery - using detailed textures etc - then the following technique isn't very straight forward, but if it's as simple as the example image then this technique is an option. It seemed worth mentioning should anyone else have a similar problem. Raster Roads Although your specific game runs right ...


8

For optimal viewing of this answer, paste and run $('pre').css('line-height', '1em'); in your JavaScript console. Refreshing the page or running $('pre').css('line-height', '1.4em'); puts everything back to normal. Generation For generating a world, I recommend the Perlin noise algorithm. I'm sure there are dozens of good tutorials and explanations ...


7

I'd recommend changing Input.GetKey("space") to Input.GetKeyDown("space"). This way the check is only performed on the initial key press, rather than every frame the spacebar is held. The other issue is at the bottom of your script: ableToJump = Physics2D.Linecast(... Since the physics step (aka fixed timestep) is only updating every 2 milliseconds (by ...


5

Applying a matrix to your SpriteBatch transforms the entire draw call at once. This means you don't need to use your camera in your DrawTiles method at all. It could become a lot simpler like so: // Loop through the number of visible tiles. for (int y = 0; y <= tiles.GetUpperBound(1); y++) { for (int x = 0; x <= tiles.GetUpperBound(0);...


4

There is an easy way to fake this in a 2D tile game. First you create a tile that contains the curved shape (using alpha 0 for the "empty space"). Then for each pixel on the x-axis you store the height of the highest point that has a non-zero alpha. While your character is over one of these curved tiles, your collision routine then checks the character's x-...


4

Yay! I did it! I'm using simple simulation that takes the first position to land behind the vertical axis of the target point - from there, I take the previous simulated position and make a segment. Now I check whether the target point is below this segment. If it is - we can jump there. It's a player-controlled character on the gif. Pink is the predicted ...


4

Let's draw it! (Again ;3) Imagine all the grassy and skyey bits are your game world. That lighter coloured rectangle framed in red is the region the camera is looking at. A player would only actually see what's in the camera. We want the camera to always stay in the game world. (x,y) is the camera position w and h are the camera's width and height Let's ...


4

To dynamically scroll through a very large background made up of smaller frames, there are many different solution; the main idea though is quite the same. The main idea Think of your fifteen background frames as sort of "panels", which you draw one along the other so that they fit the current view width: if your view is 1280 pixels wide, and each ...


3

You can use parrallaxBackgroung and ParrallaxLayer classes They will manage all u need in an optimized manner and also its very easy to implement http://www.badlogicgames.com/forum/viewtopic.php?f=17&t=1795


3

Basically you want to have a "camera" concept to show exactly what you want in your game. In this case the camera may follow your hero, so that it tries to keep the hero centered on the screen as much as possible (similar to how the original super mario bros. game worked). In order to do so you would add all of your sprites to a parent sprite so your ...


3

I don't know a whole lot about the actual implementation of it and I doubt it's the usual way to handle it, but to me ClipTextures or (Sparse) Virtual Texturing comes to mind. Essentially -from my perspective at least- the idea is to keep only the relevant part of a very large texture file located on the hard-drive in system memory and an even smaller "clip ...


3

The code to set up your matrix should go something like this: Viewport vp = GraphicsDevice.Viewport; Vector2 cameraWorldPosition = (whatever); Vector2 screenCentre = new Vector2(vp.Width / 2, vp.Height / 2); // This first translates the camera target back to the origin (0,0). // In SpriteBatch the origin normally appears in the top left of the screen // ...


3

I'd try something like this: Go from the start to the end and place the platforms at semi-random positions. Ensure this basic level is solvable, i.e. the end may be reached. Once that's done, use additional iterations to add more optional platforms. When placing those, you can verify that they're not too close or don't overlap for example. As an ...


3

Buy a better keyboard. Ghosting is caused by the hardware itself. Even many gaming keyboards will still have this problem; they only invest in fixing the problem for "common" keys like WASD (but not 'K' for instance). http://www.microsoft.com/appliedsciences/antighostingexplained.mspx


3

You should create your project in 3D, although it's only a minor convenience. The two modes don't change any aspects of what your game can do or the fundamental workflow, they just configure certain defaults you can easily change as needed. In 2D mode, images are imported as UI/Sprites by default, but if you're using 3D objects you'll typically want them ...


3

The answer to this is a synergy of a number of factors. Most people are right handed. Most languages are written from left to right. When placing objects, people typically start to the left and work to the right. Programmatically, if a game Map was represented using a two dimensional array, logical traversion of said map would require moving to the right....


2

It looks like you're constantly moving the platforms to the left, as you explain, but you're only checking for collisions along the Y axis. So what happens if you fall down a pit? The platforms will continue moving to the left, the collision will register from the right side of your player, and the position will be adjusted back up to the surface of the ...


2

SDL_FillRect(screen , &bullet[i].b , 0xFFFF66); This will fill your screen surface in the SDL_Rect &bullet[i].b Then later in the same frame, you use drawImage To draw the map over the entire size of screen, covering up the projectiles you filled it up with. I suggest you add a separate SDL_Surface* for your projectile and draw them in your draw()...


2

There are a few options. Don't use large images. Take a look at the backgrounds of many popular 2d games - especially side scrollers. You'll see that the backgrounds are usually actually composed of multiple images, usually combined with a gradient. This can give the illusion of a large image but actually take up very little space. Texture compression. ...


2

Q1: Would depend on your hardware limitations (usually mainly memory size and the speed of loading new chunks from disk) and your game, but for larger worlds, the latter one (un/loading on the way) will usually be more suitable. Note that if using this option, you will often also want to pre-load some chunks (yet-not-visible) around the borders of the ...


2

This is simply a combination of a few simple steps. First, get the mouse position, Gdx.input.getX() will give you the mouse X position. You'll want to get that position at the time the mouse button was pressed. Now, that you have a target, move your hero towards it. You can do that with something like: float deltaV = deltaTime * speed; if (Math.abs(...


2

You might want to "just calculate" the answer but I'm sure that you'll find it insufficient once you've got it because of the highly interactive nature of your "free fall" physics. Consider using a different approach: Searching. Here is how it's done for Super Mario AI: http://aigamedev.com/open/interview/mario-ai/ Searching possible pathes to get from A ...


Only top voted, non community-wiki answers of a minimum length are eligible