API similar to sensing + which works on all mobiles #1708
Closed
Eaielectronic
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
hello, here it is, I have an extension that allows you to detect a sprite with the JavaScript touch API that works on ALL mobile devices unlike sensing + but the only problem is that I can't make it so that if the finger is on the sprite it returns "true" and I would like it to be a drop-down menu to choose which sprite and that it does not create conflicts between clones of the same sprite, that each clone detects for itself: class TouchExtension {
constructor() {
this.spritesTouched = {};
} getInfo() { return { id: 'touchExtension', name: 'Touching Sensing', blocks: [ { opcode: 'isTouchingSprite', blockType: Scratch.BlockType.BOOLEAN, text: 'if finger touches this sprite [SPRITE]', arguments: { SPRITE: { type: Scratch.ArgumentType.STRING, defaultValue: 'Sprite1' } } } ] };
} isTouchingSprite(args, util) { const spriteName = args.SPRITE;
const sprite = util.target.runtime.getSpriteTargetByName(spriteName);
Beta Was this translation helpful? Give feedback.
All reactions