RawDrawing a character following an invisible character is quite easy. Assuming a full screen DrawingSurface called "background":
Code: ags
However, I'm wondering how you handle background collision detection and pathfinding on a RawDrawn background? Presumably the character can't walk everywhere, so how does the invisible character know where to walk and where not to go?
Viewframe *playerframe = Game.GetViewFrame(player.View, player.Loop, player.Frame);
//if you need to scale or tint the character, we create a DynamicSprite of him, otherwise skip this and use playerframe.Graphic instead of herosprite.Graphic later on
DynamicSprite *herosprite = DynamicSprite.CreateFromExistingSprite(playerframe.Graphic);
herosprite.Resize((herosprite.Width*player.Scaling)/100, (herosprite.Height*player.Scaling)/100));
Region *playerregion = Region.GetAtRoomXY(player.x, player.y);
if (playerregion.TintEnabled == true) {
herosprite.Tint(playerregion.TintRed, playerregion.TintGreen, playerregion.TintBlue, playerregion.TintSaturation, 100);
}
else if (playerregion.LightLevel < 0) herosprite.Tint(0, 0, 0, 0, 100+playerregion.LightLevel); //not sure about the saturation setting here
//now to RawDraw the character
background.DrawImage(player.x-(herosprite.Width/2), player.y - herosprite.Height, herosprite.Graphic); // you can also wait to resize the sprite until drawing it by using optional parameters
However, I'm wondering how you handle background collision detection and pathfinding on a RawDrawn background? Presumably the character can't walk everywhere, so how does the invisible character know where to walk and where not to go?