mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-06-28 07:10:27 -04:00
Merge pull request #1748 from joker314/feat/point-random
Implement "point towards random direction"
This commit is contained in:
commit
0a68722b80
1 changed files with 3 additions and 0 deletions
|
@ -123,6 +123,9 @@ class Scratch3MotionBlocks {
|
||||||
if (args.TOWARDS === '_mouse_') {
|
if (args.TOWARDS === '_mouse_') {
|
||||||
targetX = util.ioQuery('mouse', 'getScratchX');
|
targetX = util.ioQuery('mouse', 'getScratchX');
|
||||||
targetY = util.ioQuery('mouse', 'getScratchY');
|
targetY = util.ioQuery('mouse', 'getScratchY');
|
||||||
|
} else if (args.TOWARDS === '_random_') {
|
||||||
|
util.target.setDirection(Math.round(Math.random() * 360) - 180);
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
const pointTarget = this.runtime.getSpriteTargetByName(args.TOWARDS);
|
const pointTarget = this.runtime.getSpriteTargetByName(args.TOWARDS);
|
||||||
if (!pointTarget) return;
|
if (!pointTarget) return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue