Click here to Skip to main content
13,145,464 members (93,814 online)
Rate this:
Please Sign up or sign in to vote.
See more:

I am currently trying to develop a 2D game, but I came through a little problem. I would like to hear some answers from the experienced game developers.

So let's say I have a wall texture. A player shoots a bullet on it, then how do I draw the bullet texture on that wall texture? Later if I want to use the same texture, how do I use that exact same wall texture (without the bullet) on another wall object?

How do game developers usually do this?
Posted 5-Jan-13 0:50am
Updated 5-Jan-13 3:38am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I'm not a game developer, but I'm trying to answer your question.

There are different methods to display the above scene.
Before preparing your scene you can place all objects in proper place.

A player shoots a bullet on it, then how do I draw the bullet texture on that wall texture?

My suggestion is to redraw the scene with the background scene(wall) and bullet. You can retain the wall texture without any change. Draw objects(bullets) on top of backbground(wall).

1. Draw Wall Texture.
2. Draw Bullets( this drawing will be on top of wall ).
JackDingler 9-Jan-13 15:14pm
That's essentially it.

the technology you're looking for is called, 'decals'.
velvet7 9-Jan-13 15:32pm
This is exactly what I tried to do. The problem comes when I try to draw on the boundary of the wall. So imagine it like this:
| * |
| |

Where the * is the bullet texture. Basically it draws "in the air", which I want to avoid.
JackDingler 9-Jan-13 17:20pm
Research 'decals'. Its a technique for overlaying one texture on top of another. It has been developed to do exactly what you want.

There's no quick answer for this, but it's a common technique and many articles have been written on it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170915.1 | Last Updated 9 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100