Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: jamal on Wed 24/06/2009 21:11:26

Title: Score / Change background
Post by: jamal on Wed 24/06/2009 21:11:26
I wanted to know if theres a way to change the background when the character gets a certain score ammount. Lets say at the score of 5 the main background of a room should change. How to do this? :)

Thanks in advance
Title: Re: Score / Change background
Post by: GuyAwesome on Wed 24/06/2009 21:27:03
It should be simple enough, using game.score ( to check the current score), and SetBackgroundFrame (you can probably guess what this does). Read the manual for more details, and (along with the forums) for some basic idea of how AGS script works.
Exactly what you do with them will depend on when, where, and how you want to change to take place. If it's just one room, the 'Enters room before fade-in' event is a good place. Don't forget, you might also need to use SetBackgroundFrame to lock the initial background (unless you want it animating before 5 points are reached...), and you'll maybe need to run that check when points are scored in that room (if you want to background to change immediately). For it to happen in all (or at least a couple of) rooms, repeatedly_execute in the global script might be a better place. At it's simplest

if (game.score < 5) SetBackgroundFrame(0);
else SetBackgroungFrame(1);

Is something like what you'd need.
Title: Re: Score / Change background
Post by: jamal on Thu 25/06/2009 12:57:58
Yep it works!  ;D

Thank you!