Question

Trying to animate sprite using DirectX9 and C++

Asked by: psycho_blood

In this program, I create a window and display a cat walking back and forth between the screen using a left and right tileset of bitmaps. Also, I am trying to control two caveman sprites as follows:
- If you press the Right key, cavemanRight.bmp is loaded and the caveman runs to the right.
- If you press the Left key, cavemanLeft.bmp is loaded and the caveman runs to the left.
 
I would like to know why am I only able to display cavemanRight.bmp.
Thanks!

#include "game.h"
 
LPDIRECT3DTEXTURE9 cat_left_image;
LPDIRECT3DTEXTURE9 cat_right_image;
LPDIRECT3DTEXTURE9 caveman_left_image;
LPDIRECT3DTEXTURE9 caveman_right_image;
 
SPRITE catLeft;
SPRITE catRight;
SPRITE cavemanLeft;
SPRITE cavemanRight;
 
LPDIRECT3DSURFACE9 back;
LPD3DXSPRITE sprite_handler;
 
HRESULT result;
 
//timing variable
long start = GetTickCount();
 
//initializes the game
int Game_Init(HWND hwnd)
{
	//set random number seed
	srand(time_t(NULL));
 
	//create sprite handler object
	result = D3DXCreateSprite(d3ddev, &sprite_handler);
	if (result != D3D_OK)
		return 0;
 
	//load the background image
	back = LoadSurface("background.bmp", NULL);
 
	//load texture with "pink" as the transparent color
	cat_left_image = LoadTexture("catLeft.bmp", D3DCOLOR_XRGB(255,0,255));
	if (cat_left_image == NULL)
		return 0;
	
	// initialize catLeft's properties
	catLeft.x = 96;
	catLeft.y = 150;
	catLeft.width = 96;
	catLeft.height = 96;
	catLeft.curframe = 0;
	catLeft.lastframe = 5;
	catLeft.animdelay = 2;
	catLeft.animcount = 0;
	catLeft.movex = 8;
	catLeft.movey = 0;
	
	//load texture with "pink" as the transparent color
	cat_right_image = LoadTexture("catRight.bmp", D3DCOLOR_XRGB(255,0,255));
	if (cat_right_image == NULL)
		return 0;
 
	// initialize catRight's properties
	catRight.x = 96;
	catRight.y = 150;
	catRight.width = 96;
	catRight.height = 96;
	catRight.curframe = 0;
	catRight.lastframe = 5;
	catRight.animdelay = 2;
	catRight.animcount = 0;
	catRight.movex = 8;
	catRight.movey = 0;
 
	//load texture with "pink" as the transparent color
	caveman_left_image = LoadTexture("cavemanLeft.bmp", D3DCOLOR_XRGB(255,0,255));
	if (caveman_left_image == NULL)
		return 0;
 
	//initialize cavemanLeft's properties
	cavemanLeft.x = 100;
	cavemanLeft.y = 180;
	cavemanLeft.width = 50;
	cavemanLeft.height = 64;
	cavemanLeft.curframe = 1;
	cavemanLeft.lastframe = 11;
	cavemanLeft.animdelay = 3;
	cavemanLeft.animcount = 0;
	cavemanLeft.movex = 5;
	cavemanLeft.movey = 0;
 
	//load texture with "pink" as the transparent color
	caveman_right_image = LoadTexture("cavemanRight.bmp", D3DCOLOR_XRGB(255,0,255));
	if (caveman_right_image == NULL)
		return 0;
 
	//initialize cavemanLeft's properties
	cavemanRight.x = 100;
	cavemanRight.y = 180;
	cavemanRight.width = 50;
	cavemanRight.height = 64;
	cavemanRight.curframe = 1;
	cavemanRight.lastframe = 11;
	cavemanRight.animdelay = 3;
	cavemanRight.animcount = 0;
	cavemanRight.movex = 5;
	cavemanRight.movey = 0;
 
	//return okay
	return 1;
}
 
//the main game loop
void Game_Run(HWND hwnd)
{
	//make sure the Direct3D device is valid
	if (d3ddev == NULL)
		return;
 
	//after short delay, ready for next frame?
	//this keeps the game running at a steady frame rate
	if (GetTickCount() - start >= 30)
	{
		//reset timing
		start = GetTickCount();
 
		//move cat to the left
		catLeft.x += catLeft.movex;
		catLeft.y += catLeft.movey;
 
		//"warp" the sprite at screen edges
		if (catLeft.x > SCREEN_WIDTH - catLeft.width)
			catLeft.movex *= -1;
		else if (catLeft.x < 0)
		{
			catLeft.movex *= -1;
			catLeft.x += catLeft.movex;
		}
		
		//move cat to the right
		catRight.x += catRight.movex;
		catRight.y += catRight.movey;
 
		//"warp" the sprite at screen edges
		if (catRight.x > SCREEN_WIDTH - catRight.width)
			catRight.movex *= -1;
		else if (catRight.x < 0)
		{
			catRight.movex *= -1;
			catRight.x += catRight.movex;
		}
 
		//move caveman to the right
		if (KEY_DOWN(VK_RIGHT))
		{
			cavemanRight.x += cavemanRight.movex;
			cavemanRight.y += cavemanRight.movey;
		}
 
		//move caveman to the left
		if (KEY_DOWN(VK_LEFT))
		{
			cavemanRight.x -= cavemanRight.movex;
			cavemanRight.y -= cavemanRight.movey;
		}
 
		//"warp" the sprite at screen edges
		if (cavemanRight.x > SCREEN_WIDTH - cavemanRight.width)
		{
			cavemanRight.x = SCREEN_WIDTH - cavemanRight.width;
		}
		else if (cavemanRight.x < 0)
		{
			cavemanRight.x = 0;
		}
 
		//has animation delay reached threshold?
		if (++cavemanRight.animcount > cavemanRight.animdelay)
		{
			//reset counter
			cavemanRight.animcount = 0;
 
			//animate the sprite
			if (++cavemanRight.curframe > cavemanRight.lastframe)
				cavemanRight.curframe = 1;
		}
		
		if (++cavemanLeft.animcount > cavemanLeft.animdelay)
		{
			//reset counter
			cavemanLeft.animcount = 0;
 
			//animate the sprite
			if (++cavemanLeft.curframe > cavemanLeft.lastframe)
				cavemanLeft.curframe = 1;
		}
 
		if (++catRight.animcount > catRight.animdelay)
		{
			//reset counter
			catRight.animcount = 0;
 
			//animate the sprite
			if (++catRight.curframe > catRight.lastframe)
				catRight.curframe = 1;
		}
 
		if (++catLeft.animcount > catLeft.animdelay)
		{
			//reset counter
			catLeft.animcount = 0;
 
			//animate the sprite
			if (++catLeft.curframe > catLeft.lastframe)
				catLeft.curframe = 1;
		}
	}
 
	//start rendering
	if (d3ddev->BeginScene())
	{
		//erase the entire background
		d3ddev->StretchRect(back, NULL, backbuffer, NULL, D3DTEXF_NONE);
 
		//start sprite handler
		sprite_handler->Begin(D3DXSPRITE_ALPHABLEND);
 
		//create vector to update caveman position
		D3DXVECTOR3 cavemanRightPosition((float)cavemanRight.x, (float)cavemanRight.y, 0);
		D3DXVECTOR3 cavemanLeftPosition((float)cavemanLeft.x, (float)cavemanLeft.y, 0);
		D3DXVECTOR3 catRightPosition ((float)catRight.x, (float)catRight.y, 0);
		D3DXVECTOR3 catLeftPosition ((float)catLeft.x, (float)catLeft.y, 0);
 
		//configure the rect for the source tile
		RECT catSrcRect;
		RECT cavemanLeftSrcRect;
		RECT cavemanRightSrcRect;
 
		int catColumns = 6;
		int cavemanColumns = 8; 
 
		catSrcRect.left = (catLeft.curframe % catColumns) * catLeft.width;
		catSrcRect.top = (catLeft.curframe / catColumns) * catLeft.height;
		catSrcRect.right = catSrcRect.left + catLeft.width;
		catSrcRect.bottom = catSrcRect.top + catLeft.height;
 
		cavemanLeftSrcRect.left = (cavemanLeft.curframe % cavemanColumns) * cavemanLeft.width;
		cavemanLeftSrcRect.top = (cavemanLeft.curframe / cavemanColumns) * cavemanLeft.height;
		cavemanLeftSrcRect.right = cavemanLeftSrcRect.left + cavemanLeft.width;
		cavemanLeftSrcRect.bottom = cavemanLeftSrcRect.top + cavemanLeft.height;
 
		cavemanRightSrcRect.left = (cavemanRight.curframe % cavemanColumns) * cavemanRight.width;
		cavemanRightSrcRect.top = (cavemanRight.curframe / cavemanColumns) * cavemanRight.height;
		cavemanRightSrcRect.right = cavemanRightSrcRect.left + cavemanRight.width;
		cavemanRightSrcRect.bottom = cavemanRightSrcRect.top + cavemanRight.height;
 
		//draw the sprite
		if (cavemanRight.movex > 0)
		{
			sprite_handler->Draw(
				caveman_right_image,
				&cavemanRightSrcRect,
				NULL,
				&cavemanRightPosition,
				D3DCOLOR_XRGB(255,255,255));
		}
		else if (cavemanRight.movex < 0)
		{
			sprite_handler->Draw(
				caveman_left_image,
				&cavemanLeftSrcRect,
				NULL,
				&cavemanLeftPosition,
				D3DCOLOR_XRGB(255,255,255));
		}
 
		if (catLeft.movex > 0)
		{
			sprite_handler->Draw(
				cat_right_image,
				&catSrcRect,
				NULL,
				&catRightPosition,
				D3DCOLOR_XRGB(255,255,255));
		}
		else if (catLeft.movex < 0)
		{
			sprite_handler->Draw(
				cat_left_image,
				&catSrcRect,
				NULL,
				&catLeftPosition,
				D3DCOLOR_XRGB(255,255,255));
		}
 
		//stop drawing
		sprite_handler->End();
 
		//stop rendering
		d3ddev->EndScene();
	}
 
	//display the back buffer on the screen
	d3ddev->Present(NULL, NULL, NULL, NULL);
 
	//check for escape key (to exit program)
	if (KEY_DOWN(VK_ESCAPE))
		PostMessage(hwnd, WM_DESTROY, 0, 0);
}
 
//frees memory and cleans up before the game ends
void Game_End(HWND hwnd)
{
 
	if (caveman_left_image != NULL)
		caveman_left_image->Release();
 
	if (caveman_right_image != NULL)
		caveman_right_image->Release();
 
	if (cat_left_image != NULL)
		cat_left_image->Release();
 
	if (cat_right_image != NULL)
		cat_right_image->Release();
 
	if (back != NULL)
		back->Release();
 
	if (sprite_handler != NULL)
		sprite_handler->Release();
 
}

                                  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-04-12 at 16:48:13ID24316226
Tags

directx

,

sprite

,

animation

Topics

DirectX Graphics & Game Programming

,

Microsoft Visual C++.Net

,

C++ Programming Language

Participating Experts
1
Points
0
Comments
4

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Sprite Animation
    There are 3 parts to this question which each relate to this sprite query. Initially, I would like to refer to the use of the picture box as a way to create a sprite through the API call BItBlt. I would like to know if it possible to store the BITMAP as some kind of data str...
  2. Where to find cheap/free sprites?
    Hi all, I am trying to locate some inexpensive or free royalty free sprites I can use in a small game. I am most interested in space genre type graphics, but any graphics would be good. I already have Ari Feldman (sp?) spritelib, as well as spriteworks. any suggestion...
  3. Sprite animation, like Age of Empires', HOW DO I?
    I'm trying to figure out some method of sprite animation seemingly used in some stupid old strategy games like the old Age of Empires. Remember that one? What I want to know is how they do the animation with the characters. Bare in mind that this character can walk, stand st...
  4. Animated Character Sprites for 2D Game
    Hello. I would like to know if anyone knows of a site that provides free 2D animated character sprites in bitmap format, preferably robots. This game is a scrolling game from a side prespective, so the sprite needs idle, walking, running, jumping, and shooting animations from...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: psycho_bloodPosted on 2009-04-12 at 23:13:24ID: 24128171

OK, I already fixed most of my problems and now I can move my caveman in all directions across the screen. However, when the caveman moves to the left is not properly drawn/animated. Could anyone take a look at my code below and tell me what I am doing wrong?

#include "game.h"
 
LPDIRECT3DTEXTURE9 cat_left_image;
LPDIRECT3DTEXTURE9 cat_right_image;
LPDIRECT3DTEXTURE9 caveman_left_image;
LPDIRECT3DTEXTURE9 caveman_right_image;
 
SPRITE catLeft;
SPRITE catRight;
SPRITE cavemanLeft;
SPRITE cavemanRight;
 
LPDIRECT3DSURFACE9 back;
LPD3DXSPRITE sprite_handler;
 
HRESULT result;
 
//timing variable
long start = GetTickCount();
 
//initializes the game
int Game_Init(HWND hwnd)
{
	//set random number seed
	srand(time_t(NULL));
 
	//create sprite handler object
	result = D3DXCreateSprite(d3ddev, &sprite_handler);
	if (result != D3D_OK)
		return 0;
 
	//load the background image
	back = LoadSurface("background.bmp", NULL);
 
	//load texture with "pink" as the transparent color
	cat_left_image = LoadTexture("catLeft.bmp", D3DCOLOR_XRGB(255,0,255));
	if (cat_left_image == NULL)
		return 0;
	
	// initialize catLeft's properties
	catLeft.x = 96;
	catLeft.y = 150;
	catLeft.width = 96;
	catLeft.height = 96;
	catLeft.curframe = 0;
	catLeft.lastframe = 5;
	catLeft.animdelay = 2;
	catLeft.animcount = 0;
	catLeft.movex = 8;
	catLeft.movey = 0;
	
	//load texture with "pink" as the transparent color
	cat_right_image = LoadTexture("catRight.bmp", D3DCOLOR_XRGB(255,0,255));
	if (cat_right_image == NULL)
		return 0;
 
	// initialize catRight's properties
	catRight.x = 96;
	catRight.y = 150;
	catRight.width = 96;
	catRight.height = 96;
	catRight.curframe = 0;
	catRight.lastframe = 5;
	catRight.animdelay = 2;
	catRight.animcount = 0;
	catRight.movex = 8;
	catRight.movey = 0;
 
	//load texture with "pink" as the transparent color
	caveman_left_image = LoadTexture("cavemanLeft.bmp", D3DCOLOR_XRGB(255,0,255));
	if (caveman_left_image == NULL)
		return 0;
 
	//initialize cavemanLeft's properties
	cavemanLeft.x = 100;
	cavemanLeft.y = 180;
	cavemanLeft.width = 50;
	cavemanLeft.height = 64;
	cavemanLeft.curframe = 1;
	cavemanLeft.lastframe = 11;
	cavemanLeft.animdelay = 3;
	cavemanLeft.animcount = 0;
	cavemanLeft.movex = 5;
	cavemanLeft.movey = 0;
 
	//load texture with "pink" as the transparent color
	caveman_right_image = LoadTexture("cavemanRight.bmp", D3DCOLOR_XRGB(255,0,255));
	if (caveman_right_image == NULL)
		return 0;
 
	//initialize cavemanLeft's properties
	cavemanRight.x = 100;
	cavemanRight.y = 180;
	cavemanRight.width = 50;
	cavemanRight.height = 64;
	cavemanRight.curframe = 1;
	cavemanRight.lastframe = 11;
	cavemanRight.animdelay = 3;
	cavemanRight.animcount = 0;
	cavemanRight.movex = 5;
	cavemanRight.movey = 0;
 
	//return okay
	return 1;
}
 
//the main game loop
void Game_Run(HWND hwnd)
{
	//make sure the Direct3D device is valid
	if (d3ddev == NULL)
		return;
 
	//after short delay, ready for next frame?
	//this keeps the game running at a steady frame rate
	if (GetTickCount() - start >= 30)
	{
		//reset timing
		start = GetTickCount();
 
		//move cat to the left
		catLeft.x += catLeft.movex;
		catLeft.y += catLeft.movey;
 
		//"warp" the sprite at screen edges
		if (catLeft.x > SCREEN_WIDTH - catLeft.width)
			catLeft.movex *= -1;
		else if (catLeft.x < 0)
		{
			catLeft.movex *= -1;
			catLeft.x += catLeft.movex;
		}
		
		//move cat to the right
		catRight.x += catRight.movex;
		catRight.y += catRight.movey;
 
		//"warp" the sprite at screen edges
		if (catRight.x > SCREEN_WIDTH - catRight.width)
			catRight.movex *= -1;
		else if (catRight.x < 0)
		{
			catRight.movex *= -1;
			catRight.x += catRight.movex;
		}
 
		//move caveman to the right
		if (KEY_DOWN(VK_RIGHT))
		{
			cavemanRight.x += cavemanRight.movex;
			cavemanRight.y += cavemanRight.movey;
		}
 
		//move caveman to the left
		if (KEY_DOWN(VK_LEFT))
		{
			cavemanRight.x -= cavemanRight.movex;
			cavemanRight.y -= cavemanRight.movey;
		}
 
		//move caveman up
		if (KEY_DOWN(VK_UP))
		{
			cavemanRight.height += cavemanRight.movey;
			cavemanRight.y--;
		}
 
		//move caveman down
		if (KEY_DOWN(VK_DOWN))
		{
			cavemanRight.height -= cavemanRight.movey;
			cavemanRight.y++;
		}
 
		//"warp" the sprite at screen edges
		if (cavemanRight.x > SCREEN_WIDTH - cavemanRight.width)
		{
			cavemanRight.x = SCREEN_WIDTH - cavemanRight.width;
		}
		else if (cavemanRight.x < 0)
		{
			cavemanRight.x = 0;
		}
 
		if (cavemanRight.y > SCREEN_HEIGHT - cavemanRight.height)
		{
			cavemanRight.y = SCREEN_HEIGHT - cavemanRight.height;
		}
		else if (cavemanRight.y < 0)
		{
			cavemanRight.y = 0;
		}
 
		//move caveman to the right
		if (KEY_DOWN(VK_RIGHT))
		{
			cavemanLeft.x += cavemanLeft.movex;
			cavemanLeft.y += cavemanLeft.movey;
		}
 
		//move caveman to the left
		if (KEY_DOWN(VK_LEFT))
		{
			cavemanLeft.x -= cavemanLeft.movex;
			cavemanLeft.y -= cavemanLeft.movey;
		}
 
		//move caveman up
		if (KEY_DOWN(VK_UP))
		{
			cavemanLeft.height += cavemanLeft.movey;
			cavemanLeft.y--;
		}
 
		//move caveman down
		if (KEY_DOWN(VK_DOWN))
		{
			cavemanLeft.height -= cavemanLeft.movey;
			cavemanLeft.y++;
		}
 
		//"warp" the sprite at screen edges
		if (cavemanLeft.x > SCREEN_WIDTH - cavemanLeft.width)
		{
			cavemanLeft.x = SCREEN_WIDTH - cavemanLeft.width;
		}
		else if (cavemanLeft.x < 0)
		{
			cavemanLeft.x = 0;
		}
 
		if (cavemanLeft.y > SCREEN_HEIGHT - cavemanLeft.height)
		{
			cavemanLeft.y = SCREEN_HEIGHT - cavemanLeft.height;
		}
		else if (cavemanLeft.y < 0)
		{
			cavemanLeft.y = 0;
		}
 
 
		//has animation delay reached threshold?
		if (++cavemanRight.animcount > cavemanRight.animdelay)
		{
			//reset counter
			cavemanRight.animcount = 0;
 
			//animate the sprite
			if (++cavemanRight.curframe > cavemanRight.lastframe)
				cavemanRight.curframe = 1;
		}
		
		if (++cavemanLeft.animcount > cavemanLeft.animdelay)
		{
			//reset counter
			cavemanLeft.animcount = 0;
 
			//animate the sprite
			if (++cavemanLeft.curframe > cavemanLeft.lastframe)
				cavemanLeft.curframe = 1;
		}
 
		if (++catRight.animcount > catRight.animdelay)
		{
			//reset counter
			catRight.animcount = 0;
 
			//animate the sprite
			if (++catRight.curframe > catRight.lastframe)
				catRight.curframe = 1;
		}
 
		if (++catLeft.animcount > catLeft.animdelay)
		{
			//reset counter
			catLeft.animcount = 0;
 
			//animate the sprite
			if (++catLeft.curframe > catLeft.lastframe)
				catLeft.curframe = 1;
		}
	}
 
	//start rendering
	if (d3ddev->BeginScene())
	{
		//erase the entire background
		d3ddev->StretchRect(back, NULL, backbuffer, NULL, D3DTEXF_NONE);
 
		//start sprite handler
		sprite_handler->Begin(D3DXSPRITE_ALPHABLEND);
 
		//create vector to update caveman position
		D3DXVECTOR3 cavemanRightPosition((float)cavemanRight.x, (float)cavemanRight.y, 0);
		D3DXVECTOR3 cavemanLeftPosition((float)cavemanLeft.x, (float)cavemanLeft.y, 0);
		D3DXVECTOR3 catRightPosition ((float)catRight.x, (float)catRight.y, 0);
		D3DXVECTOR3 catLeftPosition ((float)catLeft.x, (float)catLeft.y, 0);
 
		//configure the rect for the source tile
		RECT catSrcRect;
		RECT cavemanLeftSrcRect;
		RECT cavemanRightSrcRect;
 
		int catColumns = 6;
		int cavemanColumns = 8; 
 
		catSrcRect.left = (catLeft.curframe % catColumns) * catLeft.width;
		catSrcRect.top = (catLeft.curframe / catColumns) * catLeft.height;
		catSrcRect.right = catSrcRect.left + catLeft.width;
		catSrcRect.bottom = catSrcRect.top + catLeft.height;
 
		cavemanLeftSrcRect.left = (cavemanLeft.curframe % cavemanColumns) * cavemanLeft.width;
		cavemanLeftSrcRect.top = (cavemanLeft.curframe / cavemanColumns) * cavemanLeft.height;
		cavemanLeftSrcRect.right = cavemanLeftSrcRect.left + cavemanLeft.width;
		cavemanLeftSrcRect.bottom = cavemanLeftSrcRect.top + cavemanLeft.height;
 
		cavemanRightSrcRect.left = (cavemanRight.curframe % cavemanColumns) * cavemanRight.width;
		cavemanRightSrcRect.top = (cavemanRight.curframe / cavemanColumns) * cavemanRight.height;
		cavemanRightSrcRect.right = cavemanRightSrcRect.left + cavemanRight.width;
		cavemanRightSrcRect.bottom = cavemanRightSrcRect.top + cavemanRight.height;
 
		//draw the sprite
		//if (cavemanRight.movex > 0)
		if (KEY_DOWN(VK_RIGHT)) //I need a better condition than this!
		{
			sprite_handler->Draw(
				caveman_right_image,
				&cavemanRightSrcRect,
				NULL,
				&cavemanRightPosition,
				D3DCOLOR_XRGB(255,255,255));
		}
		//else if (cavemanRight.movex < 0)
		else if (KEY_DOWN(VK_LEFT)) //I need a better condition than this!
		{
			sprite_handler->Draw(
				caveman_left_image,
				&cavemanLeftSrcRect,
				NULL,
				&cavemanLeftPosition,
				D3DCOLOR_XRGB(255,255,255));
		}
 
		if (catLeft.movex > 0)
		{
			sprite_handler->Draw(
				cat_right_image,
				&catSrcRect,
				NULL,
				&catRightPosition,
				D3DCOLOR_XRGB(255,255,255));
		}
		else if (catLeft.movex < 0)
		{
			sprite_handler->Draw(
				cat_left_image,
				&catSrcRect,
				NULL,
				&catLeftPosition,
				D3DCOLOR_XRGB(255,255,255));
		}
 
		//stop drawing
		sprite_handler->End();
 
		//stop rendering
		d3ddev->EndScene();
	}
 
	//display the back buffer on the screen
	d3ddev->Present(NULL, NULL, NULL, NULL);
 
	//check for escape key (to exit program)
	if (KEY_DOWN(VK_ESCAPE))
		PostMessage(hwnd, WM_DESTROY, 0, 0);
}
 
//frees memory and cleans up before the game ends
void Game_End(HWND hwnd)
{
 
	if (caveman_left_image != NULL)
		caveman_left_image->Release();
 
	if (caveman_right_image != NULL)
		caveman_right_image->Release();
 
	if (cat_left_image != NULL)
		cat_left_image->Release();
 
	if (cat_right_image != NULL)
		cat_right_image->Release();
 
	if (back != NULL)
		back->Release();
 
	if (sprite_handler != NULL)
		sprite_handler->Release();
 
}
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394:
395:
396:
397:
398:
399:
400:

Select allOpen in new window

 

by: DeepuAbrahamKPosted on 2009-04-14 at 21:56:57ID: 24144794

I can see two times  'move caveman to the left" is this needed?

		//move caveman to the left
		if (KEY_DOWN(VK_LEFT))
		{
			cavemanRight.x -= cavemanRight.movex;
			cavemanRight.y -= cavemanRight.movey;
		}
 
		//move caveman to the left
		if (KEY_DOWN(VK_LEFT))
		{
			cavemanLeft.x -= cavemanLeft.movex;
			cavemanLeft.y -= cavemanLeft.movey;
		}
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:

Select allOpen in new window

 

by: psycho_bloodPosted on 2009-04-14 at 22:28:10ID: 24144906

I am sure duplicating code is not the most efficient way to program, considering all possible cases worked for me. So far, my code is still duplicated, but I might change it to a switch instead of nested if. What do you think?

 

by: psycho_bloodPosted on 2009-05-04 at 20:56:46ID: 24301449

The attached code shows how I fixed my original problem. The program is not perfect but it works.

#include "game.h"
 
LPDIRECT3DTEXTURE9 cat_left_image;
LPDIRECT3DTEXTURE9 cat_right_image;
LPDIRECT3DTEXTURE9 caveman_left_image;
LPDIRECT3DTEXTURE9 caveman_right_image;
 
SPRITE catLeft;
SPRITE catRight;
SPRITE cavemanLeft;
SPRITE cavemanRight;
 
LPDIRECT3DSURFACE9 back;
LPD3DXSPRITE sprite_handler;
 
HRESULT result;
 
//timing variable
long start = GetTickCount();
 
//initializes the game
int Game_Init(HWND hwnd)
{
	//set random number seed
	srand(time_t(NULL));
 
	//create sprite handler object
	result = D3DXCreateSprite(d3ddev, &sprite_handler);
	if (result != D3D_OK)
		return 0;
 
	//load the background image
	back = LoadSurface("background.bmp", NULL);
 
	//load texture with "pink" as the transparent color
	cat_left_image = LoadTexture("catLeft.bmp", D3DCOLOR_XRGB(255,0,255));
	if (cat_left_image == NULL)
		return 0;
	
	// initialize catLeft's properties
	catLeft.x = 96;
	catLeft.y = 150;
	catLeft.width = 96;
	catLeft.height = 96;
	catLeft.curframe = 0;
	catLeft.lastframe = 5;
	catLeft.animdelay = 2;
	catLeft.animcount = 0;
	catLeft.movex = 8;
	catLeft.movey = 0;
	
	//load texture with "pink" as the transparent color
	cat_right_image = LoadTexture("catRight.bmp", D3DCOLOR_XRGB(255,0,255));
	if (cat_right_image == NULL)
		return 0;
 
	// initialize catRight's properties
	catRight.x = 96;
	catRight.y = 150;
	catRight.width = 96;
	catRight.height = 96;
	catRight.curframe = 0;
	catRight.lastframe = 5;
	catRight.animdelay = 2;
	catRight.animcount = 0;
	catRight.movex = 8;
	catRight.movey = 0;
 
	//load texture with "pink" as the transparent color
	caveman_left_image = LoadTexture("cavemanLeft.bmp", D3DCOLOR_XRGB(255,0,255));
	if (caveman_left_image == NULL)
		return 0;
 
	//initialize cavemanLeft's properties
	cavemanLeft.x = 100;
	cavemanLeft.y = 180;
	cavemanLeft.width = 50;
	cavemanLeft.height = 64;
	cavemanLeft.curframe = 1;
	cavemanLeft.lastframe = 11;
	cavemanLeft.animdelay = 3;
	cavemanLeft.animcount = 0;
	cavemanLeft.movex = 5;
	cavemanLeft.movey = 0;
 
	//load texture with "pink" as the transparent color
	caveman_right_image = LoadTexture("cavemanRight.bmp", D3DCOLOR_XRGB(255,0,255));
	if (caveman_right_image == NULL)
		return 0;
 
	//initialize cavemanLeft's properties
	cavemanRight.x = 100;
	cavemanRight.y = 180;
	cavemanRight.width = 50;
	cavemanRight.height = 64;
	cavemanRight.curframe = 1;
	cavemanRight.lastframe = 11;
	cavemanRight.animdelay = 3;
	cavemanRight.animcount = 0;
	cavemanRight.movex = 5;
	cavemanRight.movey = 0;
 
	//return okay
	return 1;
}
 
//the main game loop
void Game_Run(HWND hwnd)
{
	//make sure the Direct3D device is valid
	if (d3ddev == NULL)
		return;
 
	//after short delay, ready for next frame?
	//this keeps the game running at a steady frame rate
	if (GetTickCount() - start >= 30)
	{
		//reset timing
		start = GetTickCount();
 
		//move cat to the left
		catLeft.x += catLeft.movex;
		catLeft.y += catLeft.movey;
 
		//"warp" the sprite at screen edges
		if (catLeft.x > SCREEN_WIDTH - catLeft.width)
			catLeft.movex *= -1;
		else if (catLeft.x < 0)
		{
			catLeft.movex *= -1;
			catLeft.x += catLeft.movex;
		}
		
		//move cat to the right
		catRight.x += catRight.movex;
		catRight.y += catRight.movey;
 
		//"warp" the sprite at screen edges
		if (catRight.x > SCREEN_WIDTH - catRight.width)
			catRight.movex *= -1;
		else if (catRight.x < 0)
		{
			catRight.movex *= -1;
			catRight.x += catRight.movex;
		}
 
		//move caveman to the right
		if (KEY_DOWN(VK_RIGHT))
		{
			cavemanRight.x += cavemanRight.movex;
			cavemanRight.y += cavemanRight.movey;
		}
 
		//move caveman to the left
		if (KEY_DOWN(VK_LEFT))
		{
			cavemanRight.x -= cavemanRight.movex;
			cavemanRight.y -= cavemanRight.movey;
		}
 
		//move caveman up
		if (KEY_DOWN(VK_UP))
		{
			cavemanRight.height += cavemanRight.movey;
			cavemanRight.y--;
		}
 
		//move caveman down
		if (KEY_DOWN(VK_DOWN))
		{
			cavemanRight.height -= cavemanRight.movey;
			cavemanRight.y++;
		}
 
		//"warp" the sprite at screen edges
		if (cavemanRight.x > SCREEN_WIDTH - cavemanRight.width)
		{
			cavemanRight.x = SCREEN_WIDTH - cavemanRight.width;
		}
		else if (cavemanRight.x < 0)
		{
			cavemanRight.x = 0;
		}
 
		if (cavemanRight.y > SCREEN_HEIGHT - cavemanRight.height)
		{
			cavemanRight.y = SCREEN_HEIGHT - cavemanRight.height;
		}
		else if (cavemanRight.y < 0)
		{
			cavemanRight.y = 0;
		}
 
		//move caveman to the right
		if (KEY_DOWN(VK_RIGHT))
		{
			cavemanLeft.x += cavemanLeft.movex;
			cavemanLeft.y += cavemanLeft.movey;
		}
 
		//move caveman to the left
		if (KEY_DOWN(VK_LEFT))
		{
			cavemanLeft.x -= cavemanLeft.movex;
			cavemanLeft.y -= cavemanLeft.movey;
		}
 
		//move caveman up
		if (KEY_DOWN(VK_UP))
		{
			cavemanLeft.height += cavemanLeft.movey;
			cavemanLeft.y--;
		}
 
		//move caveman down
		if (KEY_DOWN(VK_DOWN))
		{
			cavemanLeft.height -= cavemanLeft.movey;
			cavemanLeft.y++;
		}
 
		//"warp" the sprite at screen edges
		if (cavemanLeft.x > SCREEN_WIDTH - cavemanLeft.width)
		{
			cavemanLeft.x = SCREEN_WIDTH - cavemanLeft.width;
		}
		else if (cavemanLeft.x < 0)
		{
			cavemanLeft.x = 0;
		}
 
		if (cavemanLeft.y > SCREEN_HEIGHT - cavemanLeft.height)
		{
			cavemanLeft.y = SCREEN_HEIGHT - cavemanLeft.height;
		}
		else if (cavemanLeft.y < 0)
		{
			cavemanLeft.y = 0;
		}
 
 
		//has animation delay reached threshold?
		if (++cavemanRight.animcount > cavemanRight.animdelay)
		{
			//reset counter
			cavemanRight.animcount = 0;
 
			//animate the sprite
			if (++cavemanRight.curframe > cavemanRight.lastframe)
				cavemanRight.curframe = 1;
		}
		
		if (++cavemanLeft.animcount > cavemanLeft.animdelay)
		{
			//reset counter
			cavemanLeft.animcount = 0;
 
			//animate the sprite
			if (++cavemanLeft.curframe > cavemanLeft.lastframe)
				cavemanLeft.curframe = 1;
		}
 
		if (++catRight.animcount > catRight.animdelay)
		{
			//reset counter
			catRight.animcount = 0;
 
			//animate the sprite
			if (++catRight.curframe > catRight.lastframe)
				catRight.curframe = 1;
		}
 
		if (++catLeft.animcount > catLeft.animdelay)
		{
			//reset counter
			catLeft.animcount = 0;
 
			//animate the sprite
			if (++catLeft.curframe > catLeft.lastframe)
				catLeft.curframe = 1;
		}
	}
 
	//start rendering
	if (d3ddev->BeginScene())
	{
		//erase the entire background
		d3ddev->StretchRect(back, NULL, backbuffer, NULL, D3DTEXF_NONE);
 
		//start sprite handler
		sprite_handler->Begin(D3DXSPRITE_ALPHABLEND);
 
		//create vector to update caveman position
		D3DXVECTOR3 cavemanRightPosition((float)cavemanRight.x, (float)cavemanRight.y, 0);
		D3DXVECTOR3 cavemanLeftPosition((float)cavemanLeft.x, (float)cavemanLeft.y, 0);
		D3DXVECTOR3 catRightPosition ((float)catRight.x, (float)catRight.y, 0);
		D3DXVECTOR3 catLeftPosition ((float)catLeft.x, (float)catLeft.y, 0);
 
		//configure the rect for the source tile
		RECT catSrcRect;
		RECT cavemanLeftSrcRect;
		RECT cavemanRightSrcRect;
 
		int catColumns = 6;
		int cavemanColumns = 8; 
 
		catSrcRect.left = (catLeft.curframe % catColumns) * catLeft.width;
		catSrcRect.top = (catLeft.curframe / catColumns) * catLeft.height;
		catSrcRect.right = catSrcRect.left + catLeft.width;
		catSrcRect.bottom = catSrcRect.top + catLeft.height;
 
		cavemanLeftSrcRect.left = (cavemanLeft.curframe % cavemanColumns) * cavemanLeft.width;
		cavemanLeftSrcRect.top = (cavemanLeft.curframe / cavemanColumns) * cavemanLeft.height;
		cavemanLeftSrcRect.right = cavemanLeftSrcRect.left + cavemanLeft.width;
		cavemanLeftSrcRect.bottom = cavemanLeftSrcRect.top + cavemanLeft.height;
 
		cavemanRightSrcRect.left = (cavemanRight.curframe % cavemanColumns) * cavemanRight.width;
		cavemanRightSrcRect.top = (cavemanRight.curframe / cavemanColumns) * cavemanRight.height;
		cavemanRightSrcRect.right = cavemanRightSrcRect.left + cavemanRight.width;
		cavemanRightSrcRect.bottom = cavemanRightSrcRect.top + cavemanRight.height;
 
		//draw the sprite
		//if (cavemanRight.movex > 0)
		if (KEY_DOWN(VK_RIGHT)) //I need a better condition than this!
		{
			sprite_handler->Draw(
				caveman_right_image,
				&cavemanRightSrcRect,
				NULL,
				&cavemanRightPosition,
				D3DCOLOR_XRGB(255,255,255));
		}
		//else if (cavemanRight.movex < 0)
		else if (KEY_DOWN(VK_LEFT)) //I need a better condition than this!
		{
			sprite_handler->Draw(
				caveman_left_image,
				&cavemanLeftSrcRect,
				NULL,
				&cavemanLeftPosition,
				D3DCOLOR_XRGB(255,255,255));
		}
 
		if (catLeft.movex > 0)
		{
			sprite_handler->Draw(
				cat_right_image,
				&catSrcRect,
				NULL,
				&catRightPosition,
				D3DCOLOR_XRGB(255,255,255));
		}
		else if (catLeft.movex < 0)
		{
			sprite_handler->Draw(
				cat_left_image,
				&catSrcRect,
				NULL,
				&catLeftPosition,
				D3DCOLOR_XRGB(255,255,255));
		}
 
		//stop drawing
		sprite_handler->End();
 
		//stop rendering
		d3ddev->EndScene();
	}
 
	//display the back buffer on the screen
	d3ddev->Present(NULL, NULL, NULL, NULL);
 
	//check for escape key (to exit program)
	if (KEY_DOWN(VK_ESCAPE))
		PostMessage(hwnd, WM_DESTROY, 0, 0);
}
 
//frees memory and cleans up before the game ends
void Game_End(HWND hwnd)
{
 
	if (caveman_left_image != NULL)
		caveman_left_image->Release();
 
	if (caveman_right_image != NULL)
		caveman_right_image->Release();
 
	if (cat_left_image != NULL)
		cat_left_image->Release();
 
	if (cat_right_image != NULL)
		cat_right_image->Release();
 
	if (back != NULL)
		back->Release();
 
	if (sprite_handler != NULL)
		sprite_handler->Release();
 
}
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394:
395:
396:
397:
398:
399:
400:

Select allOpen in new window

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...