# Boss fights

3 replies to this topic

### #1 seanpk21

seanpk21

GMC Member

• New Member
• 57 posts

Posted 12 September 2011 - 09:54 PM

How would one create a boss object that:
1. Stops and shakes when hit
2. Increasingly turns red with each hit
3. Teleport all over the room
• 0

### #2 thegame

thegame

Flying Penguin

• GMC Member
• 1404 posts
• Version:GM:Studio

Posted 12 September 2011 - 10:10 PM

To make it stop and shake, you do something like this
```//Create
base_x=x;
shake=0;

//In the event when attacked -
shake=30;

//Step

if(shake>0) {
if(x>base_x+3) { //Change the '3's to create the range of motion you want
hspeed=4; //Change the speed to the speed you want to shake at
} else if(x<base_x+3) {
hspeed=-4;
}
if(shake=1) {
x=base_x;
alarm[0]=room_speed*3; //This will be understood later... in the teleportation part
} else {
alarm[0]=-1;
}
shake-=1;
} else {
shake=0;
base_x=x;
}```

For the turning red, I know it is possible, though I don't know how to blend a colour into a sprite... so I can't really answer this...
For teleporting
```//Create
alarm[0]=room_speed*3; //3 seconds
//Alarm 0 Event
x=irandom_range(0,room_width);
y=irandom_range(0,room_height);
alarm[0]=room_speed*3 //Change this if you want it to teleport at a different rate
```

Edited by thegame, 12 September 2011 - 10:12 PM.

• 0

### #3 seanpk21

seanpk21

GMC Member

• New Member
• 57 posts

Posted 12 September 2011 - 10:30 PM

The boss just moves to the left continuously after being hit.
• 0

### #4 thegame

thegame

Flying Penguin

• GMC Member
• 1404 posts
• Version:GM:Studio

Posted 12 September 2011 - 11:08 PM

Oh... Whoops I put the wrong symbol... I meant to do it like this
```
if(shake>0) {

if(x<base_x+3) { //Change the '3's to create the range of motion you want

hspeed=4; //Change the speed to the speed you want to shake at

} else if(x>base_x+3) {

hspeed=-4;

}

if(shake=1) {

x=base_x;

alarm[0]=room_speed*3; //This will be understood later... in the teleportation part

} else {

alarm[0]=-1;

}

shake-=1;

} else {

shake=0;

base_x=x;

}```
VERY sorry for that!
• 0

#### 0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users