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:
when gf clicked forever if <touching [bullet v]?> hide wait (pick random (2) to (10)) secs go to x: (-240) y: (0) show end end
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 receive [enemy_come_in v] forever set [enemy health v] to (10) broadcast [start enemy AI v] wait until <not<(enemy 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:
when gf clicked forever set [counter v] to (1) repeat (length of [x positions v]) go to x:(item (counter) of [x positions v]) y:(item (counter) of [y positions v]) move (speed) steps stamp if <touching [player v]?> change [player health v] by (-10) replace item (counter) of [x positions v] with (original x)//another list replace item (counter) of [y positions v] with (original y)//could go here else replace item (counter) of [x positions v] with (x position) replace item (counter) of [y positions v] with (y position) end change [counter v] by (1)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.
Offline