Hello
I have a Ship sprite and a Shield sprite set to always be at Ship's location, but the Shield sprite lags behind about 3-4 pixels the previous location when my ship is moving fast. I want it to be exactly the same position as the Ship at all times.
I used this for the Shield sprite:
[blocks]
<when green flag clicked>
<set[ ghost ]effect to( 60 )
<show>
<go to front>
<go back( 3 )layers>
<forever>
<go to[ MainShip ]
[/blocks]
Is it possible? What should I change to make it work? Thanks
-Tommy
Offline
Unfortunately, this can't be fixed. There's about a 0.01 second delay between blocks, so it's always going to lag.
Offline
roger- wrote:
here's one way to fix it.
after the movement script for the ship, add a broadcast.
in the script for the shield, do
when I receive[blah]
go to ship
ahhh thank you very much!
Now I can add ship attachments and all sorts of stuff ^^
Offline
You can also as the same movement script to the shield as ship.
Offline
LOL you all are funny
And thx ColorFusion. I'll probably make the same movement for the shadow of the ship on a lower layer since I want it a bit offset. Or just offset the center of the shadow sprite and use the broadcast command. hmmm......
Offline
Ay, let's not point out the bad word misspelling now, okay? ^^ *goes and fixes it*
I noticed that you used the ghost effect for the shield. Aside from the fact that there's a execution delay between blocks, costume effects (the ghost effect in this case) can also cause lag to some degree.
Making the movement script for the ship the same as the sprite should work, the broadcast technique could work as well in this case.
Offline
cheddargirl wrote:
Ay, let's not point out the bad word misspelling now, okay? ^^ *goes and fixes it*
I noticed that you used the ghost effect for the shield. Aside from the fact that there's a execution delay between blocks, costume effects (the ghost effect in this case) can also cause lag to some degree.![]()
Making the movement script for the ship the same as the sprite should work, the broadcast technique could work as well in this case.![]()
It is not the lag between blocks that is the problem. it is the order of execution.
in your project, the sheild goes to the ship then the ship moves, thus resulting in a lagging shield. to fix this, just make the sheild go to the ship after the ship moves.
Offline
roger- wrote:
It is not the lag between blocks that is the problem. it is the order of execution. in your project, the sheild goes to the ship then the ship moves, thus resulting in a lagging shield. to fix this, just make the sheild go to the ship after the ship moves.
Oh I see... Thanks roger
Before, I had the beginning of the shield like:
[blocks]
<when green flag clicked>
<forever>
<go to[ MainShip ]
[/blocks]
which is fine if the ship doesn't move, but once the ship moves, the shield has to catch up, thus resulting in "lag".
But to fellow Scratchers' advice, I added a Broadcast so when any movement key is pressed, the shield goes with it, thus matching the movements perfectly.
It was mentioned it can simple copy over the same movement controls as the ship to the shield.
*gets smarter* o.o;
-Tommy
Offline