Um... I think I see what you mean. The same sprite can't be in two places at one time, but if you want the same sprite to reappear AFTER you kill it, that's not hard. Let's say you want the sprite to 'die' after being hit by the sprite 'bullet' and then reappear after between 2 and 10 seconds at the point X:-240, Y:0. You'd probably do something like this:
whenclicked
foreveriftouchingbullet ▼?hidewaitpick randomsecs2to10go to x:-240y:0show
Last edited by Scratcher456 (2012-08-25 15:33:59)
Offline
BirdByte wrote:
Scratcher456 wrote:
The same sprite can't be in two places at one time, but if you want the same sprite to reappear AFTER you kill it, that's not hard.
Actually, it can. Stamping FTW.
Stamping is one of the best tools Scratch offers. Unfortunately it can be quite complex to program some really cool stamping techniques.
Anyway, the basic code is something like this:
when I receiveenemy_come_in ▼foreversetenemy health ▼to10broadcaststart enemy AI ▼wait untilnotenemy health>0
Offline
BirdByte wrote:
Scratcher456 wrote:
The same sprite can't be in two places at one time, but if you want the same sprite to reappear AFTER you kill it, that's not hard.
Actually, it can. Stamping FTW.
True, I hadn't thought of that. The problem is, stamping can get confusing. FAST. It also tends to slow things down when used too much. Theoretically, though, it's not hard to have one sprite be several sprites. I've never played with it, but I've seen some really cool stuff done with it.
Offline
Scratcher456 wrote:
BirdByte wrote:
Scratcher456 wrote:
The same sprite can't be in two places at one time, but if you want the same sprite to reappear AFTER you kill it, that's not hard.
Actually, it can. Stamping FTW.
True, I hadn't thought of that. The problem is, stamping can get confusing. FAST. It also tends to slow things down when used too much. Theoretically, though, it's not hard to have one sprite be several sprites. I've never played with it, but I've seen some really cool stuff done with it.
Turbo mode or single frame code makes it instant. And with an easy function for the sprite to perform, for example move until i die or hit the player. It's rather simple to implement:
With a list of original xs, ys, and two more for the mutable positions, you can easily have as any enemies as you want. And with changing "ifs" that use the counter variable, you can have them behave differently. I try to use as few sprites as possible in my projects, so I use this a lot.whenclicked
foreversetcounter ▼to1repeatlength ofx positions ▼go to x:itemy:counterofx positions ▼itemcounterofy positions ▼movespeedstepsstampiftouchingplayer ▼?changeplayer health ▼by-10replace itemcounterofx positions ▼withoriginal xanother listreplace itemcounterofy positions ▼withoriginal ycould go hereelsereplace itemcounterofx positions ▼withx positionreplace itemcounterofy positions ▼withy positionchangecounter ▼by1
Offline