About Store Forum Documentation Contact
Donations:
289$/mo



Post Reply 
Game::door
Author Message
Babulesnik Offline
Member

Post: #1
Game::door
In WE I created the door. When you click the left mouse button it should open, but there was no reaction occurs. What have I missed?

Code:
Game::ObjMemx<Game::Static> Statics_login;
Game::ObjMemx<Game::Door> Door1;

Bool Init_Login()
{
...
   Game::World.setObjType(Statics_login,OBJ_STATIC),
   Game::World.setObjType(Door1,OBJ_DOOR);
   Game::World.New("C:/Documents and Settings/Дима/Рабочий стол/EsenthelEngineSDK/Data/World/worldlogin.world");
   Game::World.update(Cam.at);
...
}

Bool Update_Login()
{
...
    Game::World.update(Cam.at);

      if(Ms.bp(0))
             {
          Door1[0].open();
      }
...
}


Attached File(s) Image(s)
   
06-05-2011 11:58 AM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #2
RE: Game::door
Have you look at the doors tutorial? "EsenthelEngineSDK\Tutorials\Source\Advanced\4 - Demos, Game Basics\Game Basics\07 - Doors.cpp"
06-06-2011 06:51 AM
Find all posts by this user Quote this message in a reply
Babulesnik Offline
Member

Post: #3
RE: Game::door
(06-06-2011 06:51 AM)Driklyn Wrote:  Have you look at the doors tutorial? "EsenthelEngineSDK\Tutorials\Source\Advanced\4 - Demos, Game Basics\Game Basics\07 - Doors.cpp"
Yes, I watched. I missed something?
06-07-2011 11:37 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Game::door
maybe your door object gets blocked by other actors?
try moving it up for testing so it wont collide with other objects.
if it is, you can disable collisions using Actor::ignore or Physics::ignore
06-07-2011 02:50 PM
Find all posts by this user Quote this message in a reply
Babulesnik Offline
Member

Post: #5
RE: Game::door
(06-07-2011 02:50 PM)Esenthel Wrote:  maybe your door object gets blocked by other actors?
try moving it up for testing so it wont collide with other objects.
if it is, you can disable collisions using Actor::ignore or Physics::ignore

Thanks for the reply, but I have no other Actor.

All code:
Code:
#include "stdafx.h"
#include "Main.h"
#include "../../Data/enum/_enums.h"
// TextDS  list_font  ,chat_font ,room_font;
TextDS Font_Login;
GuiObjs login_menu;
Str options_ip,Sdata;
FileText File_options;
SockAddr Adress  ;
Flt CAlpha=255;Int pokaz=0,close_create=0;

Game::ObjMemx<Game::Static> Statics_login;
Game::ObjMemx<Game::Door> Door1;


void enter_login(Ptr)
{
   Str P_Login,P_Pass;
   P_Login=login_menu.getTextLine("login_enter")();
   P_Pass =login_menu.getTextLine("pass_enter" )();

   if ((P_Login.length()<4)||(P_Pass.length()<4))
   {login_menu.getText("login_info").set("Должно быть минимум 4 символа");CAlpha=255;pokaz=1;}
   else Login(P_Login,P_Pass);
   login_menu.getTextLine("login_enter" ).clear();
   login_menu.getTextLine("pass_enter"  ).clear();
}

void create_acc(Ptr)
{
if (login_menu.getWindow("window_create").hidden()){
    (login_menu.getWindow("window_login" ).hidden(true));
    (login_menu.getWindow("window_create").hidden(false));}
}
void create_acc_cancel(Ptr)
{
if (login_menu.getWindow("window_login" ).hidden()){
    (login_menu.getWindow("window_create").hidden(true));
    (login_menu.getWindow("window_login" ).hidden(false));}
}
void create_acc_ok(Ptr)
{
    Str Login,Pass,Pass2,Mail,Nik;
    Login=login_menu.getTextLine("login")();
    Pass =login_menu.getTextLine("pass" )();
    Pass2=login_menu.getTextLine("pass2")();
    Mail =login_menu.getTextLine("mail" )();
    Nik  =login_menu.getTextLine("nik"  )();

    if(Compare(Pass,Pass2)){login_menu.getText("login_info2").set("Пароли не совпадают!");CAlpha=255;pokaz=1;}else //проверка на валидность анкеты
    if((Login.length()<4)||(Pass.length()<4)||(Pass2.length()<4)||(Mail.length()<4)||(Nik.length()<4) )
       {login_menu.getText("login_info2").set("Должно быть минимум 4 символа");CAlpha=255;pokaz=1;}
    else CreateAccount(Login,Pass,Mail,Nik); //если все ок посылаем анкету

}
/******************************************************************************/
Bool Init_Login()
{
   Cam.dist =0.1;
   Cam.yaw  =-0.015;
   Cam.pitch=-0.005;
   Cam.at.set(-1.856,17.298,38.574);

   Physics.create(CSS_NONE,true,"../Installation/PhysX");

   Sun.image=Images("gfx/sky/sun.gfx");
   Sky.atmospheric();
   Clouds.layered.set(3,Images("Clouds/Layers/0.gfx"));

   Game::World.init();

   Game::World.setObjType(Statics_login,OBJ_STATIC),
   Game::World.setObjType(Door1,OBJ_DOOR);
   Game::World.New("C:/Documents and Settings/Дима/Рабочий стол/EsenthelEngineSDK/Data/World/worldlogin.world");
   Game::World.update(Cam.at);

   if( File_options.read("../Data/options.txt") )//{ options_ip=File_options.fullLine();}
   Adress.fromText(File_options.fullLine());
   if(Server.state()!=CONNECT_GREETED)
   Server.clientConnectToServer(Adress);
      D.hpRt(true);
      Gui.kb_lit.zero();
        Font_Login.reset();
        Font_Login.font=Fonts("Gui/Fonts/lobbi_font.font");
        Font_Login.scale=0.025;
    //    Font_Login.color=Color(255,233,74);

       login_menu.load("Gui/Obj/login.gobj");Gui+=login_menu;
       login_menu.getWindow("window_login" ).pos(Vec2(D.w()-D.w()-0.21,D.h()-D.h()+1.0));
       login_menu.getWindow("window_create").pos(Vec2(D.w()-D.w()-0.27,D.h()-D.h()+0.5));
       login_menu.getWindow("window_create").hidden(true);
       login_menu.getTextLine("login_enter").maxLength(12);
       login_menu.getTextLine("pass_enter" ).maxLength(12);
       login_menu.getText    ("login_info" ).tds=&Font_Login;
       login_menu.getText    ("login_info2").tds=&Font_Login;
      // Gui.tds_textline.color=Color(41,147,150);

   return true;
}
/******************************************************************************/
void Shut_Login()
{
login_menu.del();
// Server.del();
}
/******************************************************************************/
Bool Update_Login() // main updating
{
   // CamHandle(0.1f,100,CAMH_ZOOM|(Ms.b(1)?CAMH_MOVE:CAMH_ROT));
    CamHandle(0.1f,100,0);
    Game::World.update(Cam.at);

       if(Ms.bp(0))
      {
          Door1[0].open();
      }

      Gui.update();
      if(Kb.bp(KB_ESC))return false;
      if(Kb.bp(KB_S))Renderer.screenShots("C:/scrin/","jpg");


      
      login_menu.getButton("button_enter"        ).func(enter_login      );
      login_menu.getButton("button_create"       ).func(create_acc       );
      login_menu.getButton("create_button_cancel").func(create_acc_cancel);
      login_menu.getButton("create_button_ok"    ).func(create_acc_ok    );

      if(Server.receive(0))
      {
       Byte CMD=Server.data.getByte();
        switch(CMD)
        {
           case CS_CREATE_ACCOUNT:
           {  
               Bool ok;
               ok=Server.data.getBool();
               if(ok)
               {
                login_menu.getText("login_info2").set("Аккаунт создан!");CAlpha=255;pokaz=1;
                close_create=1;

               }else login_menu.getText("login_info2").set("Такой логин уже создан!");CAlpha=255;pokaz=1;
           }break;

           case CS_LOGIN:
           {
             Bool validpass,povtorlogin;
             validpass  =Server.data.getBool();
             povtorlogin=Server.data.getBool();
             if(validpass  ==true){State_Lobbi.set(2.0);login_menu.getText("login_info").set("Пароль и логин принят");CAlpha=255;pokaz=1;}
             else login_menu.getText("login_info").set("Неверный логин или пароль!");CAlpha=255;pokaz=1;
             if(povtorlogin==true){login_menu.getText("login_info").set("Аккаунт уже используется!");CAlpha=255;pokaz=1;}

           }break;
         }
      }
        if(pokaz=1){if(CAlpha!=0)CAlpha=CAlpha-1;//затухнание подсказок
        Font_Login.color=Color(255,233,74,CAlpha);
        if (CAlpha<1)pokaz=0;}

               if(close_create==1)   if(CAlpha<150) // закрыть окно при удачном созднии аккаунта
                 {if (login_menu.getWindow("window_login" ).hidden())
                      {
                        (login_menu.getWindow("window_create").hidden(true));
                        (login_menu.getWindow("window_login" ).hidden(false));
                      }
                   close_create=0;
                 }
    return true;          
}
//******************************************************************************/
void Render_login()
{
Game::World.draw();
}
void Draw_Login()
{
   Renderer(Render_login);    
   //D.clear();
   if(Server.state()!=CONNECT_GREETED)
   {D.text(0,0.6,S+"Отсутствует соеденение с сервером !");}

   Gui.draw();
}

State State_Login(Update_Login,Draw_Login,Init_Login,Shut_Login);
06-07-2011 03:33 PM
Find all posts by this user Quote this message in a reply
Babulesnik Offline
Member

Post: #6
RE: Game::door
How to speed up the opening of doors and change the direction of opening?
06-07-2011 09:10 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #7
RE: Game::door
on the image I see other actors which may block the door.

You need to make custom door class, modify Game::Door sources for speed etc.
06-07-2011 09:52 PM
Find all posts by this user Quote this message in a reply
Babulesnik Offline
Member

Post: #8
RE: Game::door
(06-07-2011 09:52 PM)Esenthel Wrote:  on the image I see other actors which may block the door.

You need to make custom door class, modify Game::Door sources for speed etc.
Thank you very much !
06-07-2011 10:03 PM
Find all posts by this user Quote this message in a reply
Post Reply