Click here to Skip to main content
11,920,772 members (58,460 online)
Rate this:
Please Sign up or sign in to vote.
See more: C++ C# OpenGL mapping

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 1:50am
Edited 5-Jan-13 4: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
0 OriginalGriff 548
1 Dave Kreskowiak 245
2 phil.o 170
3 KrunalRohit 134
4 F-ES Sitecore 130
0 OriginalGriff 6,778
1 KrunalRohit 4,530
2 Sergey Alexandrovich Kryukov 3,203
3 George Jonsson 2,815
4 Suvendu Shekhar Giri 2,181

Advertise | Privacy | Mobile
Web01 | 2.8.151120.1 | Last Updated 9 Jan 2013
Copyright © CodeProject, 1999-2015
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