YolkfolkThe Dizzy Fansite 1 logged in0 playing
Community discussion

Coding Help

Started by deflector on 25 January 2023 • 4,497 views

64 posts
#91001
@deflector That's really neat. Good thinking {yolkfolk}:thumb:
👍 1
#91003
@deflector agree with @grandad there - I bet I could have used that for my drop everything and pick it back up again issue when going into the dream machine. I was going to suggest looking at that thread (drop everything and pick it back up again)...and that bit of code in the Ko Tapu script, but your solution is much neater than anything I did!
👍 1
#91091

Hello! Can someone show me an example of using 'Room custom text'? How to connect it to specific sounds? 

👍 0
#91097
@deflector Sorry, I've never used them myself. Alex did use them in Dizzy & The Other Side, that's the only example I'm aware of.
👍 1
#91150

Is any analog of WaitTime or WaitFrames functions that allows Dizzy to act during it?

👍 0
#91155

@deflector I always just put a counter in the HandlerGameUpdate. You know, something like:

count = GameGet(G_COUNTER);
if(count>0)
{
GameSet(G_COUNTER,count-1);
if(count==1)
{
The bomb goes off or whatever
}
}

Then instead of WaitFrames, you just set G_COUNTER. (BTW don't put the counter in the DrawHud Handler)

👍 1
#91157

WaitFrames doesn't stop Dizzy moving unless you have a PlayerEnterScripted command in the function. But he cannot perform a new action as the current function isn't finished.

I've used this a previous game where Dizzy presses a button and a doorway opens (for a few seconds), but closes before he reaches it - as there is a 'hidden' gap in the other direction for him to make progress.

👍 1
#91159
@noggin-the-nog does "1" mean 1 second here?
👍 0
#91160

So the task is to change the object properties cyclically without affecting Dizzy's action ability

👍 0
#91163

@deflector The counter counts down 1 every frame, and I believe the default rate is 36 frames/sec.

If you want to change some object properties back and forth, I'd use two counters and have each one set the other when they run out.

Hope this helps

👍 1
#91167
@noggin-the-nog it works! So one step closer to release the game)
👍 1
#91234

Hi folk! The task is to change tiles when the player is touching an object and back to previous tiles when the player stops touching that object (goes out of the zone of touching).

func PlayerTouchObject( idx ) in player.gs file doesn't want to solve this. Any idea what to do?

👍 0
#91235

That one's a pain because you can use a CollideObject to change it one way but not the other.

You could use an UpdateRoom to change the tile 'off' and then a CollideObject to turn it 'on'. That'll only work if the collider gets called after the room update in each game cycle. I can't remember which way it is.

Also, you'll need to use IsPlayerUpdate() to keep them synchronised. What I mean is:

func UpdateRoom_5_5()
{
if( IsPlayerUpdate() )
{
turn tile off
}

}


func CollideObject_100_2()
{
turn tile on
}

If that doesn't work, you might have to write some code using the player and object co-ordinates and put that in the UpdateRoom function. 

👍 1
#91237

You can set a collider (or colliders if you can approach the relevant tile from more than one direction) that are disabled just one step away from the 'changing tile' and turn them on when 'actioning' the relevant tile(s) - then turning them off when exiting the collider and resetting the tile.

In my last game, I set colliders either side of the lifts in the tree hut complex, so that when a player was on the lift they couldn't switch characters and jumping off the lift reset the ability to switch characters.

Alternatively, there's always little tricks such as when the player actions the relevant tile, make it change, wait for a specific time, then make Dizzy jump or step back (move player four pixels) from the tile and switch the tile back to it's original shape.

👍 1
#91240
@grandad Yes, it's a good solution. I set additional colliders around the action zone (it's about buttons on the floor with pressed and unpressed mode) and it works well. But firstly spent a day playing around with PlayerTouchObject func :tup:  
👍 0
#91256

This reply has been nagging at me since I wrote it, so I actually tried the code out tonight. 

 

[quote data-userid="642" data-postid="91235"]

That one's a pain because you can use a CollideObject to change it one way but not the other.

You could use an UpdateRoom to change the tile 'off' and then a CollideObject to turn it 'on'. That'll only work if the collider gets called after the room update in each game cycle. I can't remember which way it is.

Also, you'll need to use IsPlayerUpdate() to keep them synchronised. What I mean is:

func UpdateRoom_5_5()
{
if( IsPlayerUpdate() )
{
turn tile off
}

}


func CollideObject_100_2()
{
turn tile on
}

If that doesn't work, you might have to write some code using the player and object co-ordinates and put that in the UpdateRoom function. 

[/quote]

 

I was wrong about the game cycle. The collider actually gets called before the room updates, so the above code won't work. What works is something like this:

func CollideObject_100_2()
{
	GameSet(G_BUTTON,1);       ///////def a game variable
}

func UpdateRoom_5_5()
{
	if( IsPlayerUpdate() )
	{
		if(GameGet(G_BUTTON)==0)
		{
			turn object off
		}
		else
		{
			turn object on

			GameSet(G_BUTTON,0);
		}
	}
}

 

I'm sure you've worked your own thing out by now deflector, but I thought I might as well share this. I have that madness where if I think I've got something wrong, I have to correct it. :tongue:  

 

👍 1
#91257
@noggin-the-nog It is a clear and much neater way not to use lots of additional objects. I'm sure I'll use this part in the next location (don't want to ruin the existing structure) :tup:
👍 0
#91335

Hello! Have some mess in the next situation: you die from the spider and respawn in spec. respawn position set with PlayerRespawn_death, and get spec. death message. How to set the same death message for all deaths from spiders and keep a specific respawn position for each spider?

👍 0
#91340

@deflector You can use the user properties in the map editor. You know how #32 and #33 are set as waypoint speed and waypoint flip? You can just add more defines like:

#def    O_RESPAWNX      34

#def    O_RESPAWNY      35

Then just use ObjGet for the respawn co-ordinates and set them for each spider in the map editor.

👍 1
#91341
@noggin-the-nog ok, but how to define the specific spider (death from it) to set in ObjGet request? would you be so kind as to show the example of respawn code lines?
👍 0