CodeDragon wrote:Hello,
I'm CodeDragon and am new to game development.
Hello CodeDragon,
CodeDragon wrote:
I have a few questions:
- How can I make players hit each other with guns etc.. , How can I check if the bullit (Which is in the air) hits him/her.
Usually you use trace-lines for that. Which means you check a line for collisions that starts from your gun and has a certain length (just any large enough value) in the direction of your gun. Check example 07 for how to do collisions.
CodeDragon wrote:
- How can I make a good map?
The most common way is to use some map-editor. A simple editor is for example irrEdit, but there are also other editors which might work. Or you might write your own map-editor (for larger games that's often a good idea as you can easier do game-specific stuff in your editor then). An alternative is sometimes to model your whole level in a 3D Modeling application (like Blender). Or any kind of mixture - doing most stuff in Blender and the rest in irrEdit.
CodeDragon wrote:
- How can I store textures in a variable for pre-loading?
Irrlicht automatically does cache textures when they are loaded.
CodeDragon wrote:
- How can I store my player details? (Is the next code ok or not?)
Code: Select all
#ifndef PLAYER_H
#define PLAYER_H
#include <irrlicht.h>
#include "Weapon.h"
#include "Inventory.h"
#define MaxPlayers 16
struct sVector
{
float X;
float Y;
float Z;
};
class cPlayer
{
private:
public:
sVector Recoil;
sVector Location;
BYTE iLife;
BYTE pTeam;
pWeapon CurrentWeapon;
};
#endif
It is your code - so you can code any way you want as long as it works. Although not everyone might like your style. For example in my case I dislike a few parts:
- Using an own vector class when Irrlicht already has one.
- Using BYTE (very MS-specific style, no real gain)
- pWeapon sounds like you typedef'ed a pointer - something I've seen a few times. I think it makes the code harder to read as you no longer see on first view if it's a pointer like a * clearly shows. (also see
http://marc.info/?l=openbsd-cvs&m=117270339530912).
CodeDragon wrote:
- And how can I make pickup marks like this:
That is points to the camera.
Usually it's simply a 3D Node. Sometimes a Billboard (Images that always look towards the camera, see IBillboardSceneNode). And then it checks for collision with the player - so when you run over it, it gets picked up.