YolkfolkThe Dizzy Fansite 0 logged in0 playing
Community discussion

Dizzy skiing? (And air level not being reset after death.)

Started by Andrey Mashinistov on 5 September 2023 • 1,220 views

15 posts
#91609

Hello all!

I have been considering creating a custom movement script in which Dizzy can gather momentum by going down a slope and use it to go up a slope and "get air" - basically skiing. The only problem is I'm not sure where to start with that, I imagine the code for falling and rolling could be useful here. Any suggestions on how to realise this crazy idea? {yolkfolk}:scratch:  

If not don't worry you can still help me! I've got another problem, I have an underwater collider object that manually kills Dizzy, however when Dizzy respawns his air level is not reset, why might that be happening and how can I fix it?

Wait! Here's another problem you can think about if you really want a challenge: how might one create scrolling text (without having a special tile for the text in question)? What I mean is having a box with text that moves but does not go beyond the limits of the box, that is to say the scrolling text only displays within the proscribed limits of the box.

Sorry for the bizarre questions! {yolkfolk}:blink:  

Thanks in advance! :tup:  

👍 0
#91663

I solved the problem with Dizzy's air level not resetting when he respawns. {yolkfolk}:yahoo:  

The reason I got so confused is because I could never find the code that resets Dizzy's air level. It turns out I couldn't find it because it doesn't exist! You know that cool thing that happens when Dizzy dies underwater and his corpse floats to the surface? It turns out that wasn't just programmed to look cool, Dizzy actually refills his lungs when he resurfaces, who knew?! So the reason Dizzy's air didn't reset for me when he respawned is because my custom death sequence didn't include Dizzy floating up to the surface. My solution? Teleport dizzy to a random waterless part of the map before he respawns! That might sound weird but it all happens in an instant so the player has no idea.

👍 0
#91704

Correction: Dizzy's air still doesn't reset. It seems teleporting Dizzy to a waterless part of the map for a few seconds does not work. How I fooled myself into thinking I'd fixed the problem, I have no idea.

Back to square one!!! :wall:  

👍 0
#91749

The air problem is solved! {yolkfolk}:yahoo:  

It actually is this time and the solution was embarrassingly simple! Just adding these two commands into the respawn code sorted everything - PlayerSet(P_AIRLEVEL, 100); PlayerSet(P_EMOTION,0);

👍 0
#91784
[quote data-userid="1965" data-postid="91609"]

Hello all!

I have been considering creating a custom movement script in which Dizzy can gather momentum by going down a slope and use it to go up a slope and "get air" - basically skiing. The only problem is I'm not sure where to start with that, I imagine the code for falling and rolling could be useful here. Any suggestions on how to realise this crazy idea? {yolkfolk}:scratch:  

If not don't worry you can still help me! I've got another problem, I have an underwater collider object that manually kills Dizzy, however when Dizzy respawns his air level is not reset, why might that be happening and how can I fix it?

Wait! Here's another problem you can think about if you really want a challenge: how might one create scrolling text (without having a special tile for the text in question)? What I mean is having a box with text that moves but does not go beyond the limits of the box, that is to say the scrolling text only displays within the proscribed limits of the box.

Sorry for the bizarre questions! {yolkfolk}:blink:  

Thanks in advance! :tup:  

[/quote]

Hi Andrey, well done on working out the air level and good luck with the skiing idea - that sounds really hard.

I can't help you with that, but I can help you with the scrolling text I think. I'm imagining something like the scrolling texts in Dizzy I, is that right?

You'd need a tile with the full text saved in the tiles folder and then you'd change the mapping coordinates to achieve the scrolling effect. I don't think there's a way of doing it without putting the full text on a tile, but you don't need to animate it, just have the text and a bit of space before and after.

One way is to use the Hud Handler and the HudDrawTile function:

HudDrawTile( text, 0,184,256,8,                      x,y,w,h, 0, 0 );

The co-ordinates I've labelled x,y,w,h are the mapping co-ordinates on the tile, so to do scrolling text you need to change the x co-ordinate whilst keeping everything else the same. So something like:

x = GameGet(G_COUNTER);

HudDrawTile( text, 56,132,128,8, 		x,0,128,8, 0, 0 );

Then in the Game Handler or elsewhere a bit of code like:

x = GameGet(G_COUNTER);
GameSet(G_COUNTER,x+1);
if(x>255) GameSet(G_COUNTER,0);

You can't put the counter in the Hud handler because the hud updates at different speeds on different computers. 

 

The other way is to use an object on the map. You can see on the map editor (BRUSH properties) that the mapping co-ords are from #7 to #10. Weirdly, they aren't named in the code so to edit them you need to write ObjSet(idx,7,edit); or ObjSet(idx,8,edit); etc.

But to do your text, you only need to change object property #7, which you can do much the same way as above, maybe calling it from an UpdateRoom function.

Hope that helps you out mate.  :smile:  

 

EDIT: Actually, it just occurred to me, both Spellbound Dizzy and Dizzy and the Other Side have a mine cart ride with a jump in it. Those might be a good places to start with your ski-jump idea.

EDIT 2: Illusion Island too.

👍 1
#91788
[quote data-userid="642" data-postid="91784"]

Hi Andrey, well done on working out the air level and good luck with the skiing idea - that sounds really hard.

I can't help you with that, but I can help you with the scrolling text I think. I'm imagining something like the scrolling texts in Dizzy I, is that right?

You'd need a tile with the full text saved in the tiles folder and then you'd change the mapping coordinates to achieve the scrolling effect. I don't think there's a way of doing it without putting the full text on a tile, but you don't need to animate it, just have the text and a bit of space before and after.

One way is to use the Hud Handler and the HudDrawTile function:

HudDrawTile( text, 0,184,256,8,                      x,y,w,h, 0, 0 );

The co-ordinates I've labelled x,y,w,h are the mapping co-ordinates on the tile, so to do scrolling text you need to change the x co-ordinate whilst keeping everything else the same. So something like:

x = GameGet(G_COUNTER);

HudDrawTile( text, 56,132,128,8, 		x,0,128,8, 0, 0 );

Then in the Game Handler or elsewhere a bit of code like:

x = GameGet(G_COUNTER);
GameSet(G_COUNTER,x+1);
if(x>255) GameSet(G_COUNTER,0);

You can't put the counter in the Hud handler because the hud updates at different speeds on different computers. 

 

The other way is to use an object on the map. You can see on the map editor (BRUSH properties) that the mapping co-ords are from #7 to #10. Weirdly, they aren't named in the code so to edit them you need to write ObjSet(idx,7,edit); or ObjSet(idx,8,edit); etc.

But to do your text, you only need to change object property #7, which you can do much the same way as above, maybe calling it from an UpdateRoom function.

Hope that helps you out mate.  :smile:  

 

EDIT: Actually, it just occurred to me, both Spellbound Dizzy and Dizzy and the Other Side have a mine cart ride with a jump in it. Those might be a good places to start with your ski-jump idea.

EDIT 2: Illusion Island too.

[/quote]

Thanks a lot, Simon! :tup:  

I had never played around with map coordinates before now but I figured there must be a way to change what part of a tile is selected, so thanks for that. I kind of predicted what you would say about needing a tile and that's fine, using a tile should do the job sufficiently, I was just curious as to whether there was another way people were aware of.

As for the skiing, I think the minecart code will be a great help, I'll have to play around with that and see how I get on!

Thanks again, hopefully I can put all this to good use in my game!

 

👍 0
#92361

New problem...
So basically, I have a series of dialog definitions the names of which are "TXT_ITEX" + item id, i.e:

#def TXT_ITEX110 "It's a box of safety matches.";
#def TXT_ITEX111 "It's a can opener.";

I want to create a function which will string together the name of the definition for any given item so Dizzy can say the desired dialog. Is this all making sense? The idea is to create an automated process which saves me from having to make a separate function for every single individual item.

 

Thanks in advance for for any suggestions!

👍 0
#92370

Let me make sure I understand Andrey. Do mean that if Dizzy actions (for example) item 110, he calls a dialog saying "It's a box of safety matches" and you want to write a single function that calls a different dialog for each item, so that when you add a new item to the map, you just add a new #def to the list and it just works?

👍 0
#92373
@andrey-mashinistov Ok, I'll have to think about that one.
👍 1
#92377

I've had one idea about your problem Andrey. It's not exactly what you want, but its close.

You could use the ObjSetName and ObjGetName functions to store and recall the texts. Let's say your items are numbered 100 - 199 and they're named in the ObjectsSetNames() function in the normal way. What you might do is for each item, add another copy to the map somewhere out of the way, numbered say 1100 - 1199. The name of each duplicate in ObjectsSetNames() would be the dialog you want for the original item.

Then you could write a bit of code like this and add it to DoPickupObject(idx):

id = ObjGet(idx,O_ID) + 1000;
jdx = ObjFind(id);
text = ObjGetName(jdx);
OpenDialogMessage( text );

Hope that works as a solution. 

 

👍 1
#92378
@noggin-the-nog Thanks for the suggestion but to be honest adding secondary copies of each item defeats the purpose of what I was trying to do here which was make this process of linking item descriptions simple and hassle free. The code I currently use looks like this:
func InvExamine(idx)
{
	if(GameGet(G_ITEM)!=0&&ObjGet(idx,O_ID)!=0);//item
	{
		id = ObjGet(idx, O_ID);
		sz = "ExamineObject_"+(str)id;
		fid = gs_fid(sz);
		if(fid!=-1)
		{
			call(fid);
			return;
		}
		else
		{
//This is where I want to add the new bit of code.
		return;
		}
		return;
	}
}

Then I create separate ExamineObject functions for each item which look something like this:

func ExamineObject_3() //Screwdriver
{
        SaneMessageDizzy(3,TXT_ITEX3,1);
	MessagePop();
}
func ExamineObject_4() //Chopsticks
{
        SaneMessageDizzy(3,TXT_ITEX4,1);
	MessagePop();
}

I asked this question because I thought there might be a simple and easy way of stringing together definition names and cutting out the middle man (i.e. the ExamineObject functions) similar to how you can string together function names. It tried this:

		txtid="TXT_ITEX"+id;
        	SaneMessageDizzy(3,txtid,1); 	MessagePop();

But that just made Dizzzy say "TXT_ITEX4" instead of "It's a pair of wooden chopsticks" or what have you. Ah, well, it's not like my current method doesn't work just fine.

👍 0
#92379
@noggin-the-nog

Thought you might appreciate seeing what I made the other day... They say imitation is the sincerest form of flattery.

[attach]529[/attach]
👍 1
#92380

You mean the character faces in the dialogs? The font looks nice as well. :tup:  

👍 1
#92381

@noggin-the-nog Yes, the character faces, I saw them in Spectrum Dizzy and just had to make my own. The font is simply my own version of Queex' font from his games, although I did have to design the Russian version all by myself. I imagine you won't appreciate the Cyrillic fully but here's a picture all the same, I'm pretty proud of it. :geek: Could still do with a little work though... I think the Ж is kind of scrawny and the К is too square.

[attach]530[/attach]

 

 

👍 1