Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

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
Updated 5-Jan-13 3:38am
v2

1 solution

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.

Quote:
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).

DrawScene()
1. Draw Wall Texture.
2. Draw Bullets( this drawing will be on top of wall ).
 
Share this answer
 
Comments
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900