createEdgeSprites()


#1

For Unit 3 Stage 14 Bubble 16, my student is trying to use createEdgeSprites() and we cannot figure out how to use it because there is no documentation. Can anyone help out?


#2

Thanks for reaching out! We are still in the process of writing documentation and this one is on our list.

createEdgeSprites() is a function that creates 4 sprites: leftEdge, rightEdge, bottomEdge, and topEdge that are placed at each edge just out of view. It puts them into a group called edges, which makes it easy to do something like characterSprite.bounceOff(edges) or characterSprite.collide(edges). These variables will autocomplete in text mode of Game Lab.

Here is an example: https://studio.code.org/projects/gamelab/nMHXNirEFnftt8o3tK3zVHLOoKeL2EIm-XPOxKuxZ_8

Thanks,
Caley


#3

Thanks for the quick response! Code.org is the best!!


#4

I am having difficulty creating edges. When I click on the link in your post, it does not take me to an example with edges? Could you please clairfy how to create edges in Unit 3.


#5

Sorry about that! I’ve updated the example code again: https://studio.code.org/projects/gamelab/Rc2crpFEGqfWV7dWwrD9vDpE3pcB648XOhmfeTt4HUA

Hope that helps.
Caley