Results 1 to 7 of 7

Thread: Three Things I Need

  1. #1
    Hard Boiled Egg Queex's Avatar
    Join Date
    Oct 2009
    Posts
    124

    Default Three Things I Need

    Thinking ahead to the next game (which I'll probably start writing around Decemberish) there are three things I want implement, and would appreciate any advice on how to go about getting them working.

    * Character switching - There are threads for this, but if I only want to switch between two characters what's the best approach to pick?
    * Scrolling X, screenflip Y - how easy will that be to do?
    * Special items that stay in the inventory and open up other menus when selected. I fiddled with menus a little in LTD- I'm guessing with sufficient cunning I can populate menus based on objects within a screen's distance.

    Thanks in advance.
    - Lost Temple Dizzy -
    - Iron Tower Dizzy -

  2. #2
    Hard Boiled Egg Meph's Avatar
    Join Date
    Apr 2007
    Location
    England, Suffolk
    Posts
    2,684

    Default

    Theres no easy way to do Character switching, best to check out the topics already open, it's all in there.

    Scrolling/flipping is easy.. the way i did it in HLD was

    Add
    GameSet(G_VIEWPORTMODE,0);
    GameSet(G_VIEWPORTFLIP,0 );
    In the func HandlerGameStart()

    And in
    HandlerGameAfterUpdate
    if( GameGet(G_VIEWPORTMODE) )
    {
    roomw = GameGet(G_ROOMW);
    roomh = GameGet(G_ROOMH);
    GameSet( G_VIEWPORTX, GameGet(G_ROOM*roomw - PlayerGet(P_ + roomw/2 );
    GameSet( G_VIEWPORTY, GameGet(G_ROOMY)*roomh - PlayerGet(P_Y) + roomh/2 );
    }


    and then when i wanted to activate it in an update room function just added
    GameSet( G_VIEWPORTMODE, 1 ); (1 turns it on and 0 turns it off)
    you'll have to watch how you build the map, especially with have moving objects.


    The Flip works the same way the of course turns the game the other way round or upside down (i shall to upside down this way form now on than the orignal difficult way. wish i knew this before HLD) lol

    No idea about menus.
    Hope that helps.
    Last edited by Meph; 16-08-10 at 05:49 PM.
    Its always the cracked ones that let the light in

  3. #3
    Hard Boiled Egg delta's Avatar
    Join Date
    Feb 2007
    Location
    North West
    Posts
    4,005

    Default

    1. not too easy, but I'm not the expert on it. Probably easier if you only want two characters.
    2. easy.
    3. fairly easy, but it does require a reasonable knowledge of how menus work.

    I'll try and expand on this later.
    Last edited by delta; 16-08-10 at 05:42 PM.





    "Quotes from the internet may not be genuine" - Abraham Lincoln

  4. #4
    Easter Egg
    Join Date
    Aug 2009
    Location
    Balham - gateway to the south
    Posts
    670

    Default

    Queex, re 'character switching', don't know if this will help to give you more of an idea but Colin helped sort it out for Daisy Goes Shopping. Look at Colin's instructions. Everything apart from the amendments to game.gs is fine. Then unpak Daisy Goes Shopping and look over the start of the game.gs file.

    There are amendments to 'loaduserdata' for inventory swaps and 'beginnewgame' (starting from chr = 1) for setting the initial character. Then I've listed the 'switching characters' in it's own set of functions before I started on the 'interactions'. I used 3 character swaps, but you will just need to use '1' for the main character and '2' for the additional character ...don't worry about all the extra bits for up to 7 characters in any of the scripts, it makes no differerence if you don't use them. Switching can be done by the 'function' or just using the code inside each function to switch remotely. You also have to put 'idle tiles' of these characters in the map using IDs 1 and 2. 1 (the main character) should be put anywhere out of view as the engine will switch from that postion to the 'starting point' in gamedef. Character 2 should be placed on the map in it's starting position.

    Also check out the ids of the tiles in the game as this identifies the costume switches, 10 is the start for the main character and 310 is the start of the second character.

    Hope this helps ...and best of luck.

  5. #5
    Hard Boiled Egg Colin's Avatar
    Join Date
    May 2007
    Location
    Worthing, West Sussex, UK
    Posts
    592

    Default

    yes, I think it's working fine now.

  6. #6
    Hard Boiled Egg delta's Avatar
    Join Date
    Feb 2007
    Location
    North West
    Posts
    4,005

    Default

    Quote Originally Posted by Queex View Post
    * Special items that stay in the inventory and open up other menus when selected.
    right. I assume you know how to create and fiddle around with your own special menus, so I'll skip that part.

    to call that menu from an item when you select it is actually quite easy.

    In function DropObject( idx ) in action.gs, insert the following highlighted code (assuming the item is ID 1000):

    Code:
    func DropObject( idx )
    {
    	if(ObjGet(idx, O_ID)==1000)
    	{
    		OpenDialogNewMenu();
    		return;
    	}
    
    	if(!IsPlayerSafe() || !IsPlayerStable()) // don't drop if not safe
    	{
    		OpenDialogMessage("YOU CAN'T DROP\nTHIS NOW!");
    		return; 
    	}
    	
    	// try private function
    	id = ObjGet(idx, O_ID);
    	fid = gs_fid("DropObject_"+(str)id);
    	if(fid!=-1)
    	{
    		call(fid);
    		return;
    	}
    	
    	DoDropObject(idx);
    }
    Obviously OpenDialogNewMenu(); would be the name of the fuction for the new menu

    if you still want to drop the item afterwards, lose the 'return;' bit of code.






    "Quotes from the internet may not be genuine" - Abraham Lincoln

  7. #7
    Hard Boiled Egg Queex's Avatar
    Join Date
    Oct 2009
    Posts
    124

    Default

    Thanks all. Once I start cracking on with it in earnest I've got somewhere to start.

    I think I'd got confused with the different threads about character switching, assuming there were different approaches because it kept cropping up. I'll make sure to leave the right ids available in the low numbers, then.

    I'm glad the item in inventory thing is as easy as that, I was concerned that there might be some sneaky other code in there somewhere to trip me up.
    - Lost Temple Dizzy -
    - Iron Tower Dizzy -

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •