Jump to content

DarthRaff

Members
  • Posts

    152
  • Joined

  • Last visited

Everything posted by DarthRaff

  1. Yes, no error, thank you very much
  2. Hello, trying some simple collision but have problem when i try to use a class functions inside another class. This are the pieces of code : .h : #include "elementograf.h" #include "nivel.h" class Prota : public ElementoGraf { public: Prota(); void moverDerecha(Nivel n); void moverIzquierda(Nivel n); . . . } .cpp: #include "elementograf.h" #include "prota.h" #include "nivel.h" void Prota::moverDerecha(Nivel n) { if (n.esPosibleMover(posX+4, posY, posX+anchura+4, posY+altura)) { posX += 4; } } void Prota::moverIzquierda(Nivel) { if (n.esPosibleMover(posX+4, posY, posX+anchura+4, posY+altura)) { posX -= 4; } } in main : void comprobarTeclas() { if(hard.comprobarTecla(TECLA_ESC)) { partidaTerminada = true; } if(hard.comprobarTecla(TECLA_DER)) { prota->moverDerecha(Nivel n); // error: expected primary-expression before "n" } if(hard.comprobarTecla(TECLA_IZQ)) { prota->moverIzquierda(Nivel n);// error: expected primary-expression before "n" } } Don't know what am i missing, can someone help me, please ? Thankyou
  3. Thank you very much, Aggror, it works
  4. Hello, Happy new year every body!!!! I'm want to load a level from a .dat file, but no succes. This is what i have: . . . nivelActual = 1; . . . void ReadFromFile() { FILE *fichDatos; char nombreFich[50]; sprintf(nombreFich, "nivel%03d.dat", nivelActual);// This line is not working fichDatos = fopen(nombreFich, "rt"); //fichDatos = fopen("nivel1.dat", "rt"); This works, so, the file exists } . . . Can someone tell me what am i doing wrong, please, thank you very much
  5. Oh, Yes, it's compiling now. Thankyou very much for your time, you helped me a lot, thankyou
  6. 1>Prueba1_250.obj : error LNK2019: unresolved external symbol "public: __thiscall Monster::~Monster(void)" (??1Monster@@QAE@XZ) referenced in function _main 1>.\Prueba1-250-Debug.exe : fatal error LNK1120: 1 unresolved externals
  7. Hello again, I tried several ways but can't make it work. can someone tell what am i doing wrong, please ? Header: #ifndef MONSTER_H #define MONSTER_H class Monster { public: Monster(); TController monstercont; TModel monsterent; TVec3 monsterpos; TVec3 monsterrot; int monsterstate; float mstartframe; float mendframe; float manimvel; void MoveMonster(TController monst); ~Monster(); }; #endif CPP: #include "engine.h" #include "monster.h" Monster::Monster() { } void Monster::MoveMonster(TController monst) { if (KeyHit(KEY_UP)) { MoveEntity (monst,Vec3(.0f,.0f,1.0f)); } } Main: #include "engine.h" #include <math.h> #include <string> #include <vector> #include "monster.h" #include <iostream> #include <sstream> using namespace std; //vector<Monster> monsterarray; //vector<Monster>::iterator monsteriter; #pragma warning(disable:4996) TController player; TModel playermesh; TBody Planebody; TModel Plane; TLight Luz; int main( int argn, char* argv[] ) { int screenx=GetSystemMetrics(0), screeny=GetSystemMetrics(1), camx=screenx/2, camy=screeny/2; Initialize() ; //Create a graphics context Graphics(screenx,screeny,32,1); AFilter(4) ; TFilter(4) ; TFramework framework=CreateFramework(); TLayer layer = GetFrameworkLayer(0); TCamera cam=GetLayerCamera(layer); PositionEntity(cam,Vec3(0,0,0)); // Setup Collisions Collisions(1, 1, 1); Collisions(1, 2, 1); Collisions(1, 3, 1); Collisions(2, 2, 1); Collisions(2, 3, 1); Collisions(3, 3, 1); // Ceate a Monster vector<Monster> monsterarray; vector<Monster>::iterator monsteriter; Monster m; m.monstercont=CreateController(2.7f,0.50f,0.30f,45.01f); m.monsterent=CreateCube(); ScaleEntity(m.monsterent,Vec3(2,5,2)); EntityColor(m.monsterent,Vec4(230,0,0,255)); m.monsterrot=Vec3(0.0f,0.0f,0.0f); m.monsterpos=Vec3(0.0f,2.0f,-3.0f); m.monsterstate=0; RotateEntity(m.monstercont,m.monsterrot); PositionEntity(m.monstercont,m.monsterpos); EntityType(m.monstercont,2); SetBodyMass(m.monstercont,80.0f); monsterarray.push_back(m); Planebody=CreateBodyBox(); Plane = CreateCube(); EntityParent(Plane,Planebody); ScaleEntity(Planebody,Vec3(100,1,100)); EntityType (Planebody,3); PositionEntity(Planebody,Vec3(0,0,0)); Luz = CreateDirectionalLight(); PositionEntity(Luz, Vec3(0,20,0)); // CREATE CONTROLLER playermesh=CreateCube(); ScaleEntity(playermesh,Vec3(1,1.84,1)); EntityColor(playermesh,Vec4(0,230,0,255)); float playersf=8.99f; float playerff=9.0f; float playerav=1.0f; player=CreateController(1.84f,0.50f,0.3f,45.01f); EntityType(player,1); SetBodyMass(player,2.0f); float move=0.0; float strafe=0.0; bool crouch=0; TVec3 camrotation=Vec3(0); TVec3 playerpos; TVec3 camerapos; float mx=0; float my=0; HideMouse(); MoveMouse(camx,camy); PositionEntity(player,Vec3(0.0f,3.0f,-10.0f)); PositionEntity(playermesh,EntityPosition(player)); RotateEntity(playermesh,Vec3(0.0f,180.0f,0.0f)); int debphy=0; //Main loop // Game loop while( !KeyHit(KEY_ESCAPE) && !AppTerminate() ) { if( !AppSuspended() ) // We are not in focus! { if(KeyHit(KEY_P)){debphy=1-debphy;DebugPhysics(debphy);} move=(KeyDown(KEY_W)-KeyDown(KEY_S)); strafe=(KeyDown(KEY_D)-KeyDown(KEY_A)); //Jumping float jump=0.0; if (KeyHit(KEY_SPACE)) { if (!ControllerAirborne(player)) { jump=4.0; } } //Run if (KeyDown(KEY_LSHIFT)||KeyDown(KEY_RSHIFT)) { if (!ControllerAirborne(player)) { move/=2.0; strafe/=2.0; } } float cameraheight=1.74f; if ((!ControllerAirborne(player))&& ControllerCrouched(player)==1){ cameraheight=0.80f; } playerpos=EntityPosition(player); //Camera looking mx=Curve(MouseX()-GraphicsWidth()/2,mx,3); my=Curve(MouseY()-GraphicsHeight()/2,my,3); MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); camrotation.X=camrotation.X+my/5.0; if (camrotation.X < -90){ camrotation.X = -90;} if (camrotation.X > 90){ camrotation.X = 90;} camrotation.Y=camrotation.Y-mx/5.0; RotateEntity(cam,camrotation); ////Set controller input UpdateController(player,camrotation.Y,move*3.0,strafe*3.0,jump,500,1,KeyDown(KEY_LCONTROL)); PositionEntity(cam,Vec3(playerpos.X,Curve(playerpos.Y+cameraheight,EntityPosition(cam).Y,4.0/AppSpeed()),playerpos.Z)); camerapos=EntityPosition(cam); PositionEntity(playermesh,Vec3(camerapos.X,camerapos.Y,camerapos.Z)); RotateEntity(playermesh,Vec3(camrotation.X*-1,camrotation.Y+180.f,0.0f)); for(monsteriter=monsterarray.begin();monsteriter!=monsterarray.end();monsteriter++) { m.MoveMonster((*monsteriter).monstercont); } UpdateFramework(); RenderFramework(); Flip(0) ; } } // Done //exitapp: FreeFramework(framework); return Terminate() ; }
  8. Thankyou very much, i will try that tomorrow. But i think that i allready tried it before with no succes ( put the array and iterator inside .cpp), anyway not sure, so will try. The program works if i have all in the same file, but i'd like to do it in separate files, thankyou again.
  9. Here they are : 1>j:\pruebaheaders3\monster.cpp(10) : error C2065: 'monsteriter' : undeclared identifier 1>j:\pruebaheaders3\monster.cpp(10) : error C2065: 'monsterarray' : undeclared identifier 1>j:\pruebaheaders3\monster.cpp(10) : error C2228: left of '.begin' must have class/struct/union 1> type is ''unknown-type'' 1>j:\pruebaheaders3\monster.cpp(10) : error C2065: 'monsteriter' : undeclared identifier 1>j:\pruebaheaders3\monster.cpp(10) : error C2065: 'monsterarray' : undeclared identifier 1>j:\pruebaheaders3\monster.cpp(10) : error C2228: left of '.end' must have class/struct/union 1> type is ''unknown-type'' 1>j:\pruebaheaders3\monster.cpp(10) : error C2065: 'monsteriter' : undeclared identifier 1>j:\pruebaheaders3\monster.cpp(14) : error C2065: 'monsteriter' : undeclared identifier 1>j:\pruebaheaders3\monster.cpp(14) : error C2228: left of '.monstercont' must have class/struct/union
  10. Thanks for the info. Here are a smaller code for try and see the errors : Header: #ifndef MONSTER_H #define MONSTER_H class Monster { public: Monster(); TController monstercont; TModel monsterent; TVec3 monsterpos; TVec3 monsterrot; int monsterstate; float mstartframe; float mendframe; float manimvel; void MoveMonster(); ~Monster(); }; #endif CPP: #include "engine.h" #include "monster.h" Monster::Monster() { } void Monster::MoveMonster() { for(monsteriter=monsterarray.begin();monsteriter!=monsterarray.end();monsteriter++) { if (KeyHit(KEY_UP)) { MoveEntity ((*monsteriter).monstercont,Vec3(.0f,.0f,1.0f)); } } } And the main: #include "engine.h" #include <math.h> #include <string> #include <vector> #include "monster.h" #include <iostream> #include <sstream> using namespace std; vector<Monster> monsterarray; vector<Monster>::iterator monsteriter; #pragma warning(disable:4996) TController player; TModel playermesh; TBody Planebody; TModel Plane; TLight Luz; int main( int argn, char* argv[] ) { int screenx=GetSystemMetrics(0), screeny=GetSystemMetrics(1), camx=screenx/2, camy=screeny/2; Initialize() ; //Create a graphics context Graphics(screenx,screeny,32,1); AFilter(4) ; TFilter(4) ; TFramework framework=CreateFramework(); TLayer layer = GetFrameworkLayer(0); TCamera cam=GetLayerCamera(layer); PositionEntity(cam,Vec3(0,0,0)); // Setup Collisions Collisions(1, 1, 1); Collisions(1, 2, 1); Collisions(1, 3, 1); Collisions(2, 2, 1); Collisions(2, 3, 1); Collisions(3, 3, 1); // Ceate a Monster Monster m; m.monstercont=CreateController(2.7f,0.50f,0.30f,45.01f); m.monsterent=CreateCube(); ScaleEntity(m.monsterent,Vec3(2,5,2)); EntityColor(m.monsterent,Vec4(230,0,0,255)); m.monsterrot=Vec3(0.0f,0.0f,0.0f); m.monsterpos=Vec3(0.0f,2.0f,-3.0f); m.monsterstate=0; RotateEntity(m.monstercont,m.monsterrot); PositionEntity(m.monstercont,m.monsterpos); EntityType(m.monstercont,2); SetBodyMass(m.monstercont,80.0f); monsterarray.push_back(m); Planebody=CreateBodyBox(); Plane = CreateCube(); EntityParent(Plane,Planebody); ScaleEntity(Planebody,Vec3(100,1,100)); EntityType (Planebody,3); PositionEntity(Planebody,Vec3(0,0,0)); Luz = CreateDirectionalLight(); PositionEntity(Luz, Vec3(0,20,0)); // CREATE CONTROLLER playermesh=CreateCube(); ScaleEntity(playermesh,Vec3(1,1.84,1)); EntityColor(playermesh,Vec4(0,230,0,255)); float playersf=8.99f; float playerff=9.0f; float playerav=1.0f; player=CreateController(1.84f,0.50f,0.3f,45.01f); EntityType(player,1); SetBodyMass(player,2.0f); float move=0.0; float strafe=0.0; bool crouch=0; TVec3 camrotation=Vec3(0); TVec3 playerpos; TVec3 camerapos; float mx=0; float my=0; HideMouse(); MoveMouse(camx,camy); PositionEntity(player,Vec3(0.0f,3.0f,-10.0f)); PositionEntity(playermesh,EntityPosition(player)); RotateEntity(playermesh,Vec3(0.0f,180.0f,0.0f)); int debphy=0; //Main loop // Game loop while( !KeyHit(KEY_ESCAPE) && !AppTerminate() ) { if( !AppSuspended() ) // We are not in focus! { if(KeyHit(KEY_P)){debphy=1-debphy;DebugPhysics(debphy);} move=(KeyDown(KEY_W)-KeyDown(KEY_S)); strafe=(KeyDown(KEY_D)-KeyDown(KEY_A)); //Jumping float jump=0.0; if (KeyHit(KEY_SPACE)) { if (!ControllerAirborne(player)) { jump=4.0; } } //Run if (KeyDown(KEY_LSHIFT)||KeyDown(KEY_RSHIFT)) { if (!ControllerAirborne(player)) { move/=2.0; strafe/=2.0; } } float cameraheight=1.74f; if ((!ControllerAirborne(player))&& ControllerCrouched(player)==1){ cameraheight=0.80f; } playerpos=EntityPosition(player); //Camera looking mx=Curve(MouseX()-GraphicsWidth()/2,mx,3); my=Curve(MouseY()-GraphicsHeight()/2,my,3); MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); camrotation.X=camrotation.X+my/5.0; if (camrotation.X < -90){ camrotation.X = -90;} if (camrotation.X > 90){ camrotation.X = 90;} camrotation.Y=camrotation.Y-mx/5.0; RotateEntity(cam,camrotation); ////Set controller input UpdateController(player,camrotation.Y,move*3.0,strafe*3.0,jump,500,1,KeyDown(KEY_LCONTROL)); PositionEntity(cam,Vec3(playerpos.X,Curve(playerpos.Y+cameraheight,EntityPosition(cam).Y,4.0/AppSpeed()),playerpos.Z)); camerapos=EntityPosition(cam); PositionEntity(playermesh,Vec3(camerapos.X,camerapos.Y,camerapos.Z)); RotateEntity(playermesh,Vec3(camrotation.X*-1,camrotation.Y+180.f,0.0f)); m.MoveMonster(); UpdateFramework(); RenderFramework(); Flip(0) ; } } // Done //exitapp: FreeFramework(framework); return Terminate() ; } Thanks for your time
  11. You right, sorry, no time now. it give me 9 errors. I will put a shortest version or the app itself in a zip later, sorry again.
  12. Hello, trying to organize my code in a header and a cpp file but no succes. i tried many different things with no luck. can someone help me with that, please ? here are the codes: Header: #ifndef MONSTER_H #define MONSTER_H class Monster { public: Monster(); TController monstercont; TModel monsterent; TVec3 monsterpos; TVec3 monsterrot; int monsterstate; float mstartframe; float mendframe; float manimvel; void MoveMonster(); ~Monster(); }; #endif CPP: #include "engine.h" #include "monster.h" Monster::Monster() { } void Monster::MoveMonster() { for(monsteriter=monsterarray.begin();monsteriter!=monsterarray.end();monsteriter++) { if (KeyHit(KEY_UP)) { MoveEntity ((*monsteriter).monstercont,Vec3(.0f,.0f,1.0f)); } } } And the main : #include "engine.h" #include <math.h> #include <string> #include <vector> #include "monster.h" #include <iostream> #include <sstream> using namespace std; //Monster m; vector<Monster> monsterarray; vector<Monster>::iterator monsteriter; string nametext; string picname; string cname; int countimage=0; #pragma warning(disable:4996) int state; float fb; float fe; float sframe=1.0f; float eframe=40.0f; int animtex; float camzoom=1.5f; TEntity childrencount; TController player; TModel playermesh; TMesh mirillasprite; TMaterial mirillamat[2]; TTexture mirillatex; TMesh telaranya1; void Locate(int x, int y) { printf("%c[%d;%df",0x1B,y,x); } string StringToInt(int number) { stringstream ss;//create a stringstream ss << number;//add number to the stream return ss.str();//return a string with the contents of the stream //return (str)ss.c_str(); } float IntToFloat1(int n) { return(float(float(n)/float(255.0))); } TVec4 StringToVec4(string s, int noconv=0) { flt a[4], cf=0; int p=0, q=0, i=0, ci=0; string c; if(s.length()>0) { while(p<=(signed)s.length()) { q=p+1; p=(s+" ").find(" ",q)+1; c=s.substr(q-1,p-q); if((c.find(".")!=-1)|(noconv)) { sscanf(c.c_str(),"%f",&cf); a[i]=cf; } else { sscanf(c.c_str(),"%d",&ci); a[i]=IntToFloat1(ci); } i++; } } return(Vec4(a[0],a[1],a[2],a[3])); } void SlowPointEnt(TEntity ent1,TEntity ent2,float speed) { TVec3 ent1pos=EntityPosition(ent1); TVec3 ent1rot=EntityRotation(ent1,0); TVec3 ent2pos=EntityPosition(ent2); float dx=0.0; float dy=0.0; float dz=0.0; float rz=0.0; dx=ent1pos.X-ent2pos.X; dy=ent1pos.Y-ent2pos.Y; dz=ent1pos.Z-ent2pos.Z; rz=ent1rot.Z; return AlignToVector(ent1,Vec3(dx,rz,dz),3,speed); } void AnimeEntitySeq(TEntity ent, float startframe=0.0f, float finalframe=1.0f, float vel=1.0f, float partitiontime=100.0f) { float frame; frame=(AppTime()*vel)/partitiontime; frame=fmodf((float)frame,finalframe-startframe)+startframe; Animate(ent,(float)frame,1.0f,0,true); } /*void UpdateMonster() { for(monsteriter=monsterarray.begin();monsteriter!=monsterarray.end();monsteriter++) { SlowPointEnt((*monsteriter).monstercont,player,.5f); (*monsteriter).monsterrot=EntityRotation((*monsteriter).monstercont); UpdateController((*monsteriter).monstercont,(*monsteriter).monsterrot.Y,0.0f,0.0f,0.0f,500); RotateEntity((*monsteriter).monsterent,(*monsteriter).monsterrot); PositionEntity((*monsteriter).monsterent,Vec3((*monsteriter).monsterpos.X,(*monsteriter).monsterpos.Y+0.5f,(*monsteriter).monsterpos.Z)); if(KeyHit(KEY_UP)) { if((*monsteriter).monsterstate <=3) { monsteriter->monsterstate++; } else { monsteriter->monsterstate=0; } } if(KeyHit(KEY_DOWN)) { if((*monsteriter).monsterstate >=0) { monsteriter->monsterstate--; } else { monsteriter->monsterstate=3; } } switch ((*monsteriter).monsterstate) { case 1: monsteriter->mstartframe=41.0f; monsteriter->mendframe=85.0f; monsteriter->manimvel=3.0f; break; case 2: monsteriter->mstartframe=90.0f; monsteriter->mendframe=115.0f; monsteriter->manimvel=3.0f; break; case 3: monsteriter->mstartframe=149.0f; monsteriter->mendframe=184.0f; monsteriter->manimvel=3.0f; break; default: monsteriter->mstartframe=1.0f; monsteriter->mendframe=40.0f; monsteriter->manimvel=1.5f; break; } if(KeyHit(KEY_LEFT)) { sframe=41.0f; eframe=85.0f; } if(KeyHit(KEY_RIGHT)) { sframe=90.0f; eframe=115.0f; } AnimeEntitySeq((*monsteriter).monsterent,(*monsteriter).mstartframe,(*monsteriter).mendframe,(*monsteriter).manimvel,100.0f); TEntity cintura=FindChild((*monsteriter).monsterent,"Cintura"); AnimeEntitySeq(cintura,sframe,eframe,(*monsteriter).manimvel,100.0f); } }*/ void ProcessSceneObjects(TEntity scene) { TEntity ent; TModel entmesh; TVec3 entpos; string s=""; string cname; string cname2; TVec4 color; int intensity; for (int i = 1; i <= CountChildren(scene); i++) { ent = GetChild(scene,i); cname=GetEntityKey(ent,"classname",""); if(cname=="room") { EntityType(ent,2); } if(cname=="playerstart") { PositionEntity(player,EntityPosition(ent)); } } } TModel GetMeshModel(TEntity _Entity) { string strClassname; while (_Entity != NULL) { strClassname = GetEntityKey(_Entity, "class"); if (strClassname == "Model") { return _Entity; } _Entity = GetParent(_Entity); } return NULL; }; TEntity GetPickedEntity(TEntity _Entity, float _fRange, TPick& _PickData) { TEntity ReturnEntity = NULL; if (EntityPick (&_PickData, _Entity, _fRange, 0.01F)) { ReturnEntity = GetMeshModel(_PickData.entity); } return ReturnEntity; }; int main( int argn, char* argv[] ) { //int screenx=1360, screeny=768, camx=screenx/2, camy=screeny/2; int screenx=GetSystemMetrics(0), screeny=GetSystemMetrics(1), camx=screenx/2, camy=screeny/2; Initialize() ; //Create a graphics context Graphics(screenx,screeny,32,1); AFilter(4) ; TFilter(4) ; TFramework framework=CreateFramework(); TLayer layer = GetFrameworkLayer(0); TCamera cam=GetLayerCamera(layer); PositionEntity(cam,Vec3(0,0,0)); CameraZoom(cam,1.0f); TListener listener=GetFrameworkListener(); EntityParent(listener,cam); //Set Lua variable BP L=GetLuaState(); lua_pushobject(L,framework); lua_setglobal(L,"fw"); lua_pop(L,1); // Setup Initial Post Processing FX SetGodRays(0); SetHDR(0); SetSSAO(0); SetBloom(0); SetAntialias(0); SetShadowQuality(1); SetTextureQuality(1); //SetReflectionElements( ENTITY_RENDERABLE ); SetStats(2); // Setup Collisions Collisions(1, 1, 1); Collisions(1, 2, 1); Collisions(1, 3, 1); Collisions(2, 2, 1); Collisions(2, 3, 1); Collisions(3, 3, 1); // Ceate a Monster Monster m; m.monstercont=CreateController(2.7f,0.50f,0.30f,45.01f); m.monsterent=LoadModel("objs/monsters/DK1/Material4/dk1.gmf"); m.monsterrot=Vec3(0.0f,0.0f,0.0f); m.monsterpos=Vec3(0.0f,2.0f,-3.0f); m.monsterstate=0; RotateEntity(m.monstercont,m.monsterrot); PositionEntity(m.monstercont,m.monsterpos); EntityType(m.monstercont,2); SetBodyMass(m.monstercont,80.0f); monsterarray.push_back(m); int sequence=1; float framebegin; float frameend; float frame; //Load Texture Seq /*TController soldiercont=CreateController(1.84f,0.50f,0.3f,45.01f); SetBodyMass(soldiercont,60.0f); PositionEntity(soldiercont,Vec3(-3.0f,2.5f,-2.0f)); EntityType(soldiercont,2); TMesh soldiermesh=LoadMesh("Referencias/RaffRefferenceAssets2.gmf");*/ //Create a physics body /*TBody body=CreateBodyBox(); SetBodyMass(body,10.0f); TMesh mesh=CreateCube(); EntityParent(mesh,body); PositionEntity(body,Vec3(-6,5,0)); EntityType(body,2); TMaterial meshmat=LoadMaterial("objs/Pruebas/a1.mat"); PaintEntity(mesh,meshmat);*/ //Create another physics body TModel oildrum=LoadModel("scene/oildrum.gmf"); PositionEntity(oildrum,Vec3(6,5,0)); EntityType(oildrum,2); SetBodyMass(oildrum,1.0f); // CREATE CONTROLLER playermesh=LoadModel("Player/brazospru6_2.gmf"); float playersf=8.99f; float playerff=9.0f; float playerav=1.0f; player=CreateController(1.84f,0.50f,0.3f,45.01f); EntityType(player,1); //SetBodyDamping(player,.5f,.5f); SetBodyMass(player,2.0f); //SetWorldGravity(Vec3(0,-9.8f,0)); float move=0.0; float strafe=0.0; bool crouch=0; TVec3 camrotation=Vec3(0); TVec3 playerpos; TVec3 camerapos; float mx=0; float my=0; HideMouse(); MoveMouse(camx,camy); PositionEntity(player,Vec3(0.0f,3.0f,-10.0f)); PositionEntity(playermesh,EntityPosition(player)); RotateEntity(playermesh,Vec3(0.0f,180.0f,0.0f)); layer=GetFrameworkLayer(1); mirillasprite=LoadMesh("Sprites/simplesprite1.gmf",GetLayerCamera(layer)); mirillamat[0]=LoadMaterial("Sprites/white.mat"); mirillamat[1]=LoadMaterial("Sprites/green.mat"); mirillatex=mirillamat[0]; PaintEntity(mirillasprite,mirillatex); PositionEntity(mirillasprite,Vec3(0,0,0.15)); ScaleEntity(mirillasprite,Vec3(.03f,.03f,1.0f)); // Pasar a layer transparente, cargar algo con transparencias y volver a layer principal /*layer=GetFrameworkLayer(0); SetWorld(GetLayerWorld(GetFrameworkLayer(1))); telaranya1=LoadMesh("Sprites/simplesprite2.gmf"); ScaleEntity(telaranya1,Vec3(8.0f,8.0f,1.0f)); PositionEntity(telaranya1,Vec3(3.0f,2.5f,.0f)); RotateEntity(telaranya1,Vec3(.0f,45.0f,.0f)); SetWorld(GetLayerWorld(GetFrameworkLayer(0)));*/ //LOAD THE SCENE LoadScene("scene/Mansion3/hallpru2_b.sbx"); TTexture cruz=LoadTexture("Sprites/white.dds"); int debphy=0; //Main loop // Game loop while( !KeyHit(KEY_ESCAPE) && !AppTerminate() ) { if( !AppSuspended() ) // We are not in focus! { if (KeyHit(KEY_E)) { TPick pick; if (CameraPick(&pick,cam,Vec3(GraphicsWidth()/2,GraphicsHeight()/2,3.0),3,0,0)) { SendEntityMessage(GetMeshModel(pick.entity),"use"); } } if(KeyHit(KEY_P)){debphy=1-debphy;DebugPhysics(debphy);} move=(KeyDown(KEY_W)-KeyDown(KEY_S)); strafe=(KeyDown(KEY_D)-KeyDown(KEY_A)); //Jumping float jump=0.0; if (KeyHit(KEY_SPACE)) { if (!ControllerAirborne(player)) { jump=4.0; } } //Run if (KeyDown(KEY_LSHIFT)||KeyDown(KEY_RSHIFT)) { if (!ControllerAirborne(player)) { move/=2.0; strafe/=2.0; } } float cameraheight=1.74f; if ((!ControllerAirborne(player))&& ControllerCrouched(player)==1){ cameraheight=0.80f; } if(KeyHit(KEY_Z)) { if(camzoom==1.0f) { camzoom=1.5f; } else { camzoom=1.0f; } } CameraZoom(cam,camzoom); playerpos=EntityPosition(player); //Camera looking mx=Curve(MouseX()-GraphicsWidth()/2,mx,3); my=Curve(MouseY()-GraphicsHeight()/2,my,3); MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); camrotation.X=camrotation.X+my/5.0; if (camrotation.X < -90){ camrotation.X = -90;} if (camrotation.X > 90){ camrotation.X = 90;} camrotation.Y=camrotation.Y-mx/5.0; RotateEntity(cam,camrotation); ////Set controller input UpdateController(player,camrotation.Y,move*3.0,strafe*3.0,jump,500,1,KeyDown(KEY_LCONTROL)); PositionEntity(cam,Vec3(playerpos.X,Curve(playerpos.Y+cameraheight,EntityPosition(cam).Y,4.0/AppSpeed()),playerpos.Z)); camerapos=EntityPosition(cam); PositionEntity(playermesh,Vec3(camerapos.X,camerapos.Y,camerapos.Z)); RotateEntity(playermesh,Vec3(camrotation.X*-1,camrotation.Y+180.f,0.0f)); Animate(playermesh,9.0f,1.0f,0,true); if(MouseDown(2)) { mirillatex=mirillamat[1]; } else { mirillatex=mirillamat[0]; } //UpdateController(soldiercont,0.0f,0.0f,0.0f,0.0f,500); //PositionEntity(soldiermesh,EntityPosition(soldiercont)); //UpdateMonster(); m.MoveMonster(); UpdateFramework(); RenderFramework(); PaintEntity(mirillasprite,mirillatex); if(KeyHit(KEY_F1)) // Press F1 to save a screenshot { countimage+=1; picname="Pics/ScreenShoot_"; picname+=StringToInt(countimage); picname+=".jpg"; char fn[32] = {0}; _snprintf(fn, 31, (str)picname.c_str(), GetTickCount()); SaveBuffer(BackBuffer(), fn, 100); } Flip(0) ; } } // Done //exitapp: FreeFramework(framework); return Terminate() ; } Very frustrated, thankyou in advandce
  13. Hello again, Can't figure out how to use "on key release" to achive this, and i'd like to do it without an external library, but can't find the way. A lot of years ago, when i was trying quick basic, a teacher told me that i 'd have to clear the keyboard buffer to move something without that little annoying stop, but can't find how to do that in c++. If someone coul'd help me please...
  14. Thank you, i thought that i have to clean the input buffer using fflush(stdin) but it doesn't work. i will try that you say, thank you again.
  15. Hello, This is just c++, not Leadwerks. I have been looking in google a way to move something (using the console) around the screen using the keyboard trying to aboid this : When i push a key for move to the right the character, it moves one point, then stop while the key is still pushed and then start to move againg smoothing. Well, can someone tell me how can i eliminate this stop ? sorry if i ask this here but i have been looking for it in google with no result and don't know where to ask it.
  16. Hello, Wow, finally at home !!, thankyou for your answers, well, basically i was looking for the Recast and Detour library but it not have save and load functions ( at least i doesn't find them ) so i need a pathfinding sistem and i thought to try myself but need some save and load functions in lua and c++ to save and load the waypoints data in Leadwerks 2.5x. Better if someone have the complete Recast/Detour library or the files i miss, if not, the video posted by Aggror is that i need, if i can use it in 2.5x, thankyou very much
  17. Hello, Can someone tell me how can i save and load data in lua and c++ ? I'm trying to make a very simple waypoint sistem and need to store and load data, i have tried to find it in google with not luck, thankyou
  18. Nobody ? It's not the right place to ask this ?
  19. Hello, Is there any reflection shader or a way to make reflecting surfaces like mirror or reflecting floor in 2.5 ? I tried with another camera but i think it's an expensive way. Thank you in advance.
  20. DrawTex(cord y, cord x, "text") works, unfortunately it were useless for me. My intention is to find the childs names , so, the bones names of a model because i want to move a certain bone. FindChild is not finding the name and the bone exists with this name, and GetChild only finds one child with name ROOT. My model have 8 bones with their names so i'm very lost. Anyway, thankyou very much for your time
  21. Ah, ok, my fault, thankyou very much
  22. Hello, i tried : printf("Hello"), cout << "Hello" , std::cout << "....", but nothing in screen, no errors but no text. I put it after rendering comands before flip . Have i to change some camera or blend mode or somthing like that ? thankyou
  23. No error now, thankyou for your time
  24. Ah, thankyou, and what can i use instead of delay ? New error in printf: 1>j:\projects_2.50\prueba1_250\prueba1_250.cpp(573) : error C2664: 'printf' : cannot convert parameter 1 from 'std::string' to 'const char *' 1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
×
×
  • Create New...