hey i think to i m make 3d model and animate after load irrlich and use this
example ;
if i press w button my model need to move how to i do this
my english not good sorry all ty for help .
model make
-
- Posts: 616
- Joined: Wed Nov 01, 2006 6:26 pm
- Location: Cairo,Egypt
- Contact:
well your answer is here movement
always read the tutorials before asking
always read the tutorials before asking
-
- Posts: 616
- Joined: Wed Nov 01, 2006 6:26 pm
- Location: Cairo,Egypt
- Contact:
first define some boolens
bool up = false;
bool down = false;
bool right = false;
bool left = false;
well first make your class receiver look like this so when u press up key or "w"
the up=event.KeyInput.PressedDown;
then in your loop put this code
then in the end of your loop at this:
well this code is bugy a but i thinku got the idea
bool up = false;
bool down = false;
bool right = false;
bool left = false;
well first make your class receiver look like this so when u press up key or "w"
the up=event.KeyInput.PressedDown;
Code: Select all
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
if (event.EventType == EET_KEY_INPUT_EVENT)
{
switch(event.KeyInput.Key)
{
case KEY_KEY_W:
up = event.KeyInput.PressedDown;
break;
case KEY_KEY_S:
down = event.KeyInput.PressedDown;
break;
case KEY_KEY_A:
left = event.KeyInput.PressedDown;
break;
case KEY_KEY_D:
right = event.KeyInput.PressedDown;
break;
}
return true;
}
Code: Select all
if (up)
{
c.X += 5;
c.Z -= 5;
//checks if the animation is not running
if (upanim==false)
{
//runs the animation
ship->setFrameLoop(2, 31);
upanim=true;
}
Code: Select all
//checks if the animation is still running
if (upanim==true)
{
//stops the animation
ship->setFrameLoop(0, 1);
upanim=false;
}