Some general questions from an absolute Irr-noob

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
koaandl
Posts: 6
Joined: Mon Jul 26, 2010 12:30 am

Some general questions from an absolute Irr-noob

Post by koaandl »

I've just taken up using the Irrlicht engine to create my idea of a game, and there are some things i can't quiet figure by myself.

Firstly, i'm not entirely sure on how to do the main menu thing. I can create the main game loop fine, and generally get it running, but i'm not sure how i would impliment a menu, my thoughts were creating a void function that holds the game loop and one that holds the menu, then using a bool to switch between them, would this type of thing work?

Secondly, i am using the inbuilt Irrlicht FPS Camera, and it works fine, but i'm having a few issues with jumping, when the jump key is held, or pressed in rapid succession the character just flys up continuosly. Before for a simple test i was using an if-statement in the loop that checked if the player was a certain height above the map's floor, it would set the jump power to 0, hence making them fall. That worked fine until i decided to use a map that had hiegher points in it, eg stars, ramps, multiple levels.

I was thinking that i should use some sort of tempoary vector that stores the players location pre-jump, and then a check if they are higher than a particular offset of that variable, but i'm not sure how i would go by doing that in a loop.

And lastly, I have been attempting to create a melee weapon for my character, and i wan't to check the distance between the character and the target, but no matter what i try to use it either never works, or i get compiler errors. What would be the appropriate way to check the distance between the player and it's aim target?

Thanks in advance for any help!
mager
Posts: 24
Joined: Thu Jul 22, 2010 11:55 pm

Post by mager »

I haven't quite gotten around to this in IrrLicht but in Xna we would define GameStates and in the update and draw functions (update is the begining of your loop and draw is the end) we would check for the correct game state. Im not quite sure how to remove something from being draw yet though. I'll look into it and get back to you if no one else does
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Re: Some general questions from an absolute Irr-noob

Post by Acki »

koaandl wrote:Firstly, i'm not entirely sure on how to do the main menu thing. I can create the main game loop fine, and generally get it running, but i'm not sure how i would impliment a menu, my thoughts were creating a void function that holds the game loop and one that holds the menu, then using a bool to switch between them, would this type of thing work?
yes, this should work, it's like a very basic state-machine though... ;)
koaandl wrote:Secondly, i am using the inbuilt Irrlicht FPS Camera, and it works fine, but i'm having a few issues with jumping, when the jump key is held, or pressed in rapid succession the character just flys up continuosly. Before for a simple test i was using an if-statement in the loop that checked if the player was a certain height above the map's floor, it would set the jump power to 0, hence making them fall. That worked fine until i decided to use a map that had hiegher points in it, eg stars, ramps, multiple levels.

I was thinking that i should use some sort of tempoary vector that stores the players location pre-jump, and then a check if they are higher than a particular offset of that variable, but i'm not sure how i would go by doing that in a loop.
I would check if the player is on the ground or not...
this can be done by casting a ray to the ground and check if it collides with the ground so you know the distance to the ground, this way you can determine if he is on the ground or in the air...
koaandl wrote:And lastly, I have been attempting to create a melee weapon for my character, and i wan't to check the distance between the character and the target, but no matter what i try to use it either never works, or i get compiler errors. What would be the appropriate way to check the distance between the player and it's aim target?
you can easily check the distance between two vectors (player position <-> enemy position) with vec1.getDistanceFrom(vec2)...

I hope this helps... ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
koaandl
Posts: 6
Joined: Mon Jul 26, 2010 12:30 am

Post by koaandl »

Thank you very much everyone! You've been alot of help!
Post Reply