The Dink Network

Reply to Re: Splitting pillbug boss.

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
April 11th 2012, 07:30 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
Okay, so this is fairly easy to accomplish.

First of all, in the hit() procedure you will place an external() that will run a different script. We will call this script the "splitter". What it does is create two new pillbugs with half the health of the original. Note that you can still use current_sprite in external scripts, so getting the max health of the original and dividing it by two should not be a problem.
1) Put max health of boss pillbug in variable
2) Create two new pillbugs at the location of the original
3) Give the new pillbugs half the health of the original
4) Attach the same pillbug script to it
5) Kill the original sprite

This will keep them splitting like you want, but there is a problem. This cycle will never end, because you have to hit a sprite to kill it. This means that even when the last pillbugs remain with 1 max health, they will still split when you hit and kill them. The solution is to place a condition before the splitting which checks the max health of the sprite and if it is equal to 1, you don't replicate it and it will die

Hope this makes sense.