Hello! Can someone show me an example of using 'Room custom text'? How to connect it to specific sounds?
Is any analog of WaitTime or WaitFrames functions that allows Dizzy to act during it?
@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)
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.
So the task is to change the object properties cyclically without affecting Dizzy's action ability
@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
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?
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.
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.
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:
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?
@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.