About Store Forum Documentation Contact
Donations:
327$/mo



Post Reply 
problem with game codes
Author Message
bart1234 Offline
Member

Post: #1
problem with game codes
hello,

i have created a character selection screen to load a map however when i enter character sleection it says that it cant load the world file. plz take a look ad this code i hope you can find something that isnt right i used tutorials to create this.

PHP Code:
/******************************************************/
#include "stdafx.h"
#include "Main.h"
/******************************************************/
GuiObjs  gui_objs2;
Button     *btnWorld;
Button     *btnCreateChar1;
Button     *btnDeleteChar;
Button     *btnReLogin;
Image     CharSelectionBg;
/******************************************************/
#include "data/enum/_enums.h"
/******************************************************/
Game::ObjMemx<Game::Static> Statics1// container for static    objects
Game::ObjMemx<Game::Item  Items1;   // container for item      objects
Game::ObjMemx<Game::Chr   Chrs1;    // container for character objects
/******************************************************/
// custom function called when buttons are pressed
void btnWorldFunction(Ptr)
{
    
gui_objs2.del();
    {
    
StateGame.set(2.0);
    }
}
void btnCreateChar1Function(Ptr)
{
    
gui_objs2.del();
    {
    
StateCharCreate.set(2.0);
    }
}
void btnReLoginFunction(Ptr)
{
    
gui_objs2.del();
    
StateLoginScreen.set(2.0);
}
/******************************************************/
Bool InitCharSelection()
    {
        {
        
Gui.kb_lit.zero();
        
// load Gui
        
if(gui_objs2.load("gui/obj/CharacterSelection.gobj"))
            {
                
// if loaded succesfully 'gui_objs' contains all objects
                
Gui+=gui_objs2;

                
// requesting Gui objects by name
                
btnWorld=&gui_objs2.getButton("btnWorld");
                
btnCreateChar1=&gui_objs2.getButton("btnCreateChar1");
                
btnReLogin=&gui_objs2.getButton("btnReLogin");
                
                
btnWorld->func(btnWorldFunction);
                
btnCreateChar1->func(btnCreateChar1Function);
                
btnReLogin->func(btnReLoginFunction);

                
Physics.create(CSS_NONE,true,"Installation/PhysX");
                
Sun.image=Images("gfx/sky/sun.gfx");
                
Sky.atmospheric();

                
// Initialize World
                
Game::World.init();

                
// Assigning memory containers to certain Object Types
                
Game::World.setObjType(Statics1,OBJ_STATIC)  // set 'Statics' memory container for 'OBJ_STATIC' objects
                           
.setObjType(Items1  ,OBJ_ITEM  )  // set 'Items'   memory container for 'OBJ_ITEM'   objects
                           
.setObjType(Chrs1   ,OBJ_PLAYER); // set 'Chrs'    memory container for 'OBJ_PLAYER' objects

                // Engine is set up create the world
                
Game::World.New("world/charsellect.world");

                
// Updates world to use only terrain and objects at given position
                
Game::World.update(Cam.at); // which updates world to use only terrain and objects at given position, here camera position is used
                
                
return true;
             }
          return 
false;
        }
    }
/******************************************************/
void ShutCharSelection()
{

}
/******************************************************/
bool UpdateCharSelection()
    {
        
CamHandle(0.1f,100,CAMH_ZOOM|(Ms.b(1)?CAMH_MOVE:CAMH_ROT));

        
Game::World.update(Cam.at); // update the world to given position

        
Gui.update();
        return 
true;
    }
/******************************************************/
void Render1()
{
   
Game::World.draw(); // Draw world, World automatically detects active rendering mode)
}
/******************************************************/
void DrawCharSelection()
    {            
        
// Draw character selection screen
        
Gui.draw ();
        
Renderer(Render1);
    }
/******************************************************/
State StateCharSelection(UpdateCharSelection,DrawCharSelection,InitCharSelection,ShutCharSelection);
/******************************************************/ 

thx alot for your time and a good day to you.

Bart Hertman
05-21-2011 03:27 PM
Find all posts by this user Quote this message in a reply
andargor Offline
Member

Post: #2
RE: why doesnt this work.????
A path issue perhaps? Something like this maybe (add "data" to path, and "sellect" is misspelled?):

PHP Code:
// Engine is set up create the world
Game::World.New("data/world/charsellect.world"); 

or

PHP Code:
// Engine is set up create the world
Game::World.New("data/world/charselect.world"); 
05-21-2011 06:43 PM
Find all posts by this user Quote this message in a reply
bart1234 Offline
Member

Post: #3
RE: why doesnt this work.????
(05-21-2011 06:43 PM)andargor Wrote:  A path issue perhaps? Something like this maybe (add "data" to path, and "sellect" is misspelled?):

PHP Code:
// Engine is set up create the world
Game::World.New("data/world/charsellect.world"); 

or

PHP Code:
// Engine is set up create the world
Game::World.New("data/world/charselect.world"); 
thx for your reply but that is not the problem its the correct map name although i typed select wrong wink and adding data to the path didnt fix it either

thx for your reply.
05-21-2011 09:40 PM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #4
RE: why doesnt this work.????
If you're sure the path is correct, then you probably didn't build the world. Open up charsellect.world and see if there's a Game folder. If not, you didn't build it and it won't work.
05-22-2011 01:15 AM
Find all posts by this user Quote this message in a reply
bart1234 Offline
Member

Post: #5
RE: why doesnt this work.????
(05-22-2011 01:15 AM)Driklyn Wrote:  If you're sure the path is correct, then you probably didn't build the world. Open up charsellect.world and see if there's a Game folder. If not, you didn't build it and it won't work.

i see my bad i didnt build the world gonna test it today thx alot man
05-23-2011 10:19 AM
Find all posts by this user Quote this message in a reply
bart1234 Offline
Member

Post: #6
RE: why doesnt this work.????
(05-23-2011 10:19 AM)bart1234 Wrote:  
(05-22-2011 01:15 AM)Driklyn Wrote:  If you're sure the path is correct, then you probably didn't build the world. Open up charsellect.world and see if there's a Game folder. If not, you didn't build it and it won't work.

i see my bad i didnt build the world gonna test it today thx alot man

ye thx alot men got it working now. i figured it was something as stupid as that haha

Bart Hertman
(This post was last modified: 05-23-2011 11:46 AM by bart1234.)
05-23-2011 11:46 AM
Find all posts by this user Quote this message in a reply
Post Reply