Merge pull request from joker314/feat/point-random

Implement "point towards random direction"
This commit is contained in:
Paul Kaplan 2018-11-13 12:35:14 -05:00 committed by GitHub
commit 0a68722b80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -123,6 +123,9 @@ class Scratch3MotionBlocks {
if (args.TOWARDS === '_mouse_') {
targetX = util.ioQuery('mouse', 'getScratchX');
targetY = util.ioQuery('mouse', 'getScratchY');
} else if (args.TOWARDS === '_random_') {
util.target.setDirection(Math.round(Math.random() * 360) - 180);
return;
} else {
const pointTarget = this.runtime.getSpriteTargetByName(args.TOWARDS);
if (!pointTarget) return;