• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Region inside of the region event

Status
Not open for further replies.
Level 2
Joined
Aug 15, 2013
Messages
7
Hi. I'am making hack and slash rpg stile game and for one of my boss fights i need random events (example infernal animation from the sky and does x damage if hit you).
I want it a bit chaotic like 1/4 of arena have this infernal falling randomly but other 3/4 don't have it. (example you can take look at https://www.youtube.com/watch?v=oj_E76Y_oNM as here random areas of the room get flame in thats exactly what i want random areas inside region)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
The idea is quite simple, you get your big rect, you get your smaller rect which you want to be randomly inside the bigger rect. You then work out the half height and half width of the smaller rect. You then make a new rect from the bigger rect removing the half height and half width as boarders. Any random point inside this new rect will be a valid centre point for your small rect that fulfills being fully inside the bigger rect.

Another approach is to break your rect into 4 smaller rects. This allows you to define easy to predict zones to deal damage in. This is similar in style to Diablo III Butcher fight where large predictable areas of the field will light up on fire periodically.
 
Status
Not open for further replies.
Top