Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 05 Feb 2005
Offline Last Active Oct 02 2013 09:07 AM

#4801377 XNA Zombie AI

Posted by yewbie on 21 April 2011 - 03:18 PM

Just for fun try moving your update code to your draw function and see if rotation works then.

#4801371 XNA Zombie AI

Posted by yewbie on 21 April 2011 - 03:06 PM

I looked at the spritebatch.draw method, it does indeed use radians.

are you sure the below function is actually being run every frame?

protected override void Update(GameTime gameTime)

edit: it doesn't look like it does.

#4801278 can anyone help me here about tile maps

Posted by yewbie on 21 April 2011 - 10:10 AM

You need to clear your screen every single frame.

#4798835 Creating a unique id for each unit

Posted by yewbie on 15 April 2011 - 11:16 AM

If your storing them in a vector you could just use its position in the vector as its ID number.

Not a good idea, if you have 5 units and the third down the vector is destroyed, the IDs 3 and 4 would change, an ID should not change during the lifetime of the entity it identifies, also, ID 4 would no longer be valid since its left outside the vector range.

The static uint idea is good, as for the multiplayer, this depends on the architecture being used, it its server / client, every unit creation should be authorized or at least validated by the server, so the server should be the one assigning ids by order of creation notification arrival, if it is peer to peer, it gets more tricky, you could assign one of the peers the title of host and give him the responsability of assigning IDs...

I was thinking more along the lines of a unit type scenario instead of the actual unit, something static that would never change move with adding or deleting. Sorry for the confusion =p

#4798794 Creating a unique id for each unit

Posted by yewbie on 15 April 2011 - 08:43 AM

If your storing them in a vector you could just use its position in the vector as its ID number.

#4791517 How to verify whether std::cin input is a number or not?

Posted by yewbie on 28 March 2011 - 04:47 PM

I think


is what you were wanting to do.

#4790087 new

Posted by yewbie on 24 March 2011 - 01:27 PM

im new here and wanna learn c programming....where should i begin

lg OciN21

This Forum FAQ

#4788818 Should I just quit now? I'm 3 years in....

Posted by yewbie on 21 March 2011 - 03:59 PM

The best advice I ever received:

"Do what you have fun doing, doing anything else and your cheating yourself out of happiness"

edit: I was not trying to convince you stop programming, to clarify maybe you need to find a way of programming that fits you better. Or program something that interests you more.

#4787708 Has anyone else experienced these problems when running UDK?

Posted by yewbie on 18 March 2011 - 03:44 PM

I heard UDK was the best program for developing FPS games.
Sadly, my Vista and it's craziness manages to crash the editor every time I so much as use a hotkey.

Any suggestions on how to stop it from crashing when I perform such regular tasks?

I wanted to use UDK for designing the levels of my game, but I can't if it crashes like it does. Correct me if I'm wrong, but UDK is the best way to develope FPS games as a team project, right?

Have you tried running the editor as administrator?, also this question might get answered "better" on the Udk Forum

Are you getting a error message? or does it just close?

You could try the standard list:
update video drivers
reinstall udk

but I think your best bet would be posting on the Udk Forum

#4787488 Draw a rectangle with DirectX 9

Posted by yewbie on 18 March 2011 - 08:32 AM

Strange I am using textured quads, so ignore hte TEX u and v but here is my struct

//Custom vertex format

//Custom vertex
	float x;
	float y;
	float z;
	float rhw;
 	D3DCOLOR colour;
	float u;
	float v;

how are you doing your create device? like so?

        	D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dPresent, &d3dDevice);

here are all my renderstates

//Setup rendering states
	d3dDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
	d3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);

I make my vertices like so

TLVERTEX* vertices; //my vertices
vertexBuffer->Lock(0, 0, (void **)&vertices, NULL);//Lock the vertex buffer

vertices[0].colour = D3DCOLOR_ARGB (50,255,255,255);
vertices[0].x = CenterX - 32;
vertices[0].y = (CenterY)  - 32;
vertices[0].z = 0.0f;
vertices[0].rhw = 1.0f;
vertices[0].u = 0.0f;//1 - 0
vertices[0].v = 0.0f;//1 - 0

//.... same for 1,2,3

d3dDevice->DrawPrimitive (D3DPT_TRIANGLEFAN, 0, 2);

#4760908 Help

Posted by yewbie on 18 January 2011 - 03:44 PM

draw_sprite (screen, apsprite, 300, 150);

If this code compiles with whatever you may have left out (which I dont think it will)
Moving the above code to right above release_screen(); Will put it in your rendering loop (but it needs some changes before it will work)

You also are not accounting for drawing the sprite at its X / Y position when you call drawsprite

try adding
int SpriteX=0;
int SpriteY=0;

at the top, then change your draw_sprite call to
draw_sprite (screen, APsprite, SpriteX, SpriteY);

Now you need to make your key statements move the X and Y directions when you press them

if (key[KEY_UP]) SpriteY--;
else if (key[KEY_DOWN]) SpriteY++;
else if (key[KEY_RIGHT]) SpriteX++;
else if (key[KEY_LEFT]) SpriteX++;

and if you put all this in the correct locations it *should* run, although im not that familiar with allegro, the init seems really simple =p