YolkfolkThe Dizzy Fansite 1 logged in0 playing
Community discussion

Three Things I Need

Started by Queex on 16 August 2010 • 3,978 views

7 posts
#54781
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.
👍 0
#71384
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 X) *roomw - PlayerGet(P_ X) + 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.
👍 0
#71385
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.
👍 0
#71388
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.
👍 0
#71396
yes, I think it's working fine now.
👍 0
#71409

* 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):

func DropObject( idx )
{[color="Red"]
	if(ObjGet(idx, O_ID)==1000)
	{
		OpenDialogNewMenu();
		return;
	}

	if(!IsPlayerSafe() || !IsPlayerStable()) // don't drop if not safe
	{
		OpenDialogMessage("YOU CAN'T DROPnTHIS 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 :tongue:

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

  :smile:

👍 0
#71471
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.
👍 0