-
Notifications
You must be signed in to change notification settings - Fork 207
-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
follow sprite behaviour looks broken in 0.14.45 and absence of unfollow block #1505
follow sprite behaviour looks broken in 0.14.45 and absence of unfollow block #1505
Comments
You can make a sprite 'unfollow' by setting speed to 0, similar to the behavior of the re: main problem, the follow follow keeps momentum by adjusting the speed rather than explicitly setting it; in this case the acceleration you set is just enough that the default turnRate isn't fast enough for it to counteract the acceleration. an acceleration of 40 blocking it is pretty low though; I'll make it get up to max speed faster by default, as it's not adjustable in blocks and 1 second to turn around is a pretty long time now that I think of it :) If you want to see the change in behavior, switch your snippet to javascript and add in |
For the set |
Also, why does the cyan duck not get destroyed when it hits the wall? The edge of the screen is considered a wall for |
Theres a tiny bit of overhead in that it will spin up a fiber for updating any existing follow blocks, that will check check each frame if any exist, apply no updates besides internal state, and continue - you can see the implementation in the function here: https://github.com/microsoft/pxt-common-packages/pull/1022/files the first time follow is called it will start up a 'follow update loop'. There would be no additional overhead for a second / more sprite that follows though. Re: updating docs, would be good to include, I'm heading out on a flight for the week on a family vacation without wifi so someone else would have to, or I can add it when I get back :) |
cyan duck - |
Describe the bug
The follow sprite behaviour for following a sprite which has an acceleration value set looks broken in the current
beta beta
,0.14.45
/5.30.6
.I have some code which accelerates one sprite with positive
ay
until it hits edge of screen. A second sprite later is set to follow that sprite and there's a very obvious difference between the reasonable0.14.9
behaviour vs the peculiar0.14.45
. The latter initially follows the sprite only in they
direction but then when the followed sprite is very close it changes its mind and starts following it!To Reproduce
Steps to reproduce the behavior (easier to just use my demo code unless there's need to investigate other permutations of this phenomena):
ax
and set it to stay on screen.0.14.9
and0.14.45
Expected behavior
The
0.14.9
behaviour looks reasonable from my demonstration code below. The0.14.45
behaviour is bizarre and cannot be justified.One open question is what is the intended behaviour for
sprite1
ifsprite1
has an acceleration set and then it is set to follow another sprite,sprite2
.A second question is what happens if that follow is removed on
sprite1
, i.e. does the acceleration take effect again. Actually I don't see a block that would explicitly remove a follow, how is this achieveable using a block?The answers to these should be added to the follow sprite documentation - there is currently nothing about follow https://arcade.makecode.com/reference/sprites. The mouseover for the
follow
block doesn't explain this but that's probably intended to be concise?Screenshots
The pink duck is followed by yellow and green after 12 seconds.
0.14.9
0.14.45
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Here's the code for above:
The text was updated successfully, but these errors were encountered: