When I put in a fairly normal script that looks something like this onto the bullet sprite:
[blocks]<when green flag clicked>
<go to[ gun]
<show>
<repeat until><touching[ << enemy <or> edge >>
<move( 50 )steps>
<wait( 0.01 )secsc>
<if><touching[ edge]>
<broadcast[ edgetouched]>
<hide>
<change{ enemy health }by( -15][/blocks]
The broadcast edge touched is so the enemy doesn't lose health if you hit the edge. However, this works like it should.
But if the enemy has a script that looks like this:
[blocks]<when green flag clicked>
<show>
<repeat until><( <{ enemy health }> <<> 0 )>
<point towards( hero
<move( 4 )steps>
<wait( 0.05 )secsc>
<switch to costume[ dead[/blocks]
It now works approximately 30-70% of the time. I know it's caused by the movement script, but frankly I have no idea how to fix this.
Any ideas?
Offline
That's an interesting problem...would you mind posting the project so I can take a look at it?
Offline
The problem is probably that the bullet is moving at 50 step intervals and skipping right over the enemy.
Offline
MoreGamesNow wrote:
The problem is probably that the bullet is moving at 50 step intervals and skipping right over the enemy.
This is most likely the problem. I suggest replacing the "move 50 steps" block with:
Now it checks at 10 step intervals whether to keep going or not.
Offline
What Kileymeister said, but the "10 steps" part should be the length of the bullet + minimum dimensions of the enemy -1 (or just length of the bullet to be safe)
Offline