PDA

View Full Version : add-on to Joe's random movement script?



Beta Link
10-06-2008, 05:32 PM
Ok, so lately I've been working on level 2's boss in Island of Dreams. I was looking for a random movement script for the boss itself, and I found one (http://armageddongames.net/forums/showthread.php?t=100821)! The only problem is that when I was testing it by linking the boss FFCs to the script FFC, the boss would always move off the screen sooner or later. I need a way to make it stay inside the screen. Can anyone help me with this?

lucas92
10-06-2008, 09:46 PM
Well, is your boss only 1 tile wide or is it bigger? Because if it is bigger, you'll need to modify those lines:
if(this->X < 8){
if(this->X > 248){
if(this->Y < 8){
if(this->Y > 168){
8, 248 and 168 need to be others numbers if I clearly understand the script itself.
And maybe those lines also need to be changed:
this->X = (Rand(240)+8);
this->Y = (Rand(160)+8);
160 and 240 might have to be changed...

Beta Link
10-06-2008, 10:14 PM
Yeah, the level 2 boss is going to be 3x3 combos. I'll try changing the script now...

Edit: Ah! Your solution wasn't correct, lucas, but it led me to realize what I had to do! Near the top, where it told the engine to put the ffc on a random spot on the screen (this->X = (Rand(240)+8);
this->Y = (Rand(160)+8); ), I had to replace those random values with the values that are equal to where I put the boss itself. The script FFC had been spawning in a place on the screen completely different than the boss FFCs, and the script only affected the Script FFC! So the Script FFC now acts as a sort of 'core' to the boss. Sorry if it seems like I'm rambling. :P

You are still partially right, about having to change these lines:
if(this->X < 8){
if(this->X > 248){
if(this->Y < 8){
if(this->Y > 168){
That's the controlled area Joe mentioned in his topic title.

lucas92
10-07-2008, 03:38 PM
Nah, it's alright, I wasn't expecting to have the good answer. I just gave you ideas and you made it work so it's all fine. :)

Joe123
10-07-2008, 03:59 PM
Ah well, I'm glad this has come in handy =)

When I wrote it, I thought to myself that it'd be worth posting, incase someone wanted to use it for a custom boss one day.

Beta Link
10-07-2008, 04:21 PM
Oh yes, it certainly did come in handy. Thank God for you Joe, at least half the scripts in Island of Dreams were made by you. :D