Tint doesn't work when walking over regions when using a blocked parameter.

Started by xenogia, Sun 24/01/2010 12:15:15

Previous topic - Next topic

xenogia

I have three seperate regions as you walk across the room, where it starts dark and gets brighter.  If I look at an object at the other end of the screen the characters walks over to it but because this a blocked animation the region tints don't work.  Is there another way around it?  Here is my code for you to look at.

Code: ags

function region1_WalksOnto()
{
  cEgo.Tint (171, 136, 92, 46, 100);
}

function region2_WalksOnto()
{
  cEgo.Tint (171, 136, 92, 46, 80);
}

function region3_WalksOnto()
{
  cEgo.Tint (171, 136, 92, 46, 60);
}



Calin Leafshade

Yeah i noticed this when producing mccarthy.

You have to check where the player is in rep ex always

so like

Code: ags

if(Region.GetAtScreenXY(player.x,player.y) == region[1]) player.tint(0,0,0,50,50);

xenogia

Your inital code didn't work correctly, but changed it to the following:

Code: ags

function hLivingArea_Interact()
{
  cEgo.Walk (12, 300, eBlock, eWalkableAreas);
  cEgo.ChangeRoom (41, 626, 297);
}

function room_RepExec()
{
  if(Region.GetAtRoomXY(cEgo.x,cEgo.y) == region[1]) cEgo.Tint(171,136,92,46,80);
  if(Region.GetAtRoomXY(cEgo.x,cEgo.y) == region[2]) cEgo.Tint(171,136,92,46,60);
  if(Region.GetAtRoomXY(cEgo.x,cEgo.y) == region[3]) cEgo.Tint(171,136,92,46,100);
}


Still didn't work unfortuanetly.. :(

Dualnames

No wonder. It's a blocking function thus you need it to be called repeatedly. Way repeatedly.

Quote from: Calin Leafshade on Sun 24/01/2010 12:24:20
You have to check where the player is in rep ex always

Code: ags

function hLivingArea_Interact(){
  cEgo.Walk (12, 300, eBlock, eWalkableAreas);
  cEgo.ChangeRoom (41, 626, 297);
}

function repeatedly_execute_always(){

  if(Region.GetAtRoomXY(cEgo.x,cEgo.y) == region[1]) cEgo.Tint(171,136,92,46,80);
  if(Region.GetAtRoomXY(cEgo.x,cEgo.y) == region[2]) cEgo.Tint(171,136,92,46,60);
  if(Region.GetAtRoomXY(cEgo.x,cEgo.y) == region[3]) cEgo.Tint(171,136,92,46,100);
}

Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

xenogia

Thanks Dualnames, didn't you realise you could use repeatedly_execute_always in a room script.  I always thought it was only available in the global script.

EDIT: And yes it did work :)

SMF spam blocked by CleanTalk