Sensing + ios #1710
Unanswered
Eaielectronic
asked this question in
Q&A
Sensing + ios
#1710
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, I propose this extension of sensing + which works on ALL mobile devices unlike sensing + base. The only problem is that if you import the extension at the very beginning of a project, the first sprite will be bugged on the block if touch then. But in the other sprites everything works perfectly:
`(function (Scratch) {
'use strict';
const ico =
"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHdpZHRoPSIyOC44NjYwNyIgaGVpZ2h0PSIyOC44NjYwNyIgdmlld0JveD0iMCwwLDI4Ljg2NjA3LDI4Ljg2NjA3Ij48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMjI1LjA2Njk3LC0xNjUuMDY2OTcpIj48ZyBkYXRhLXBhcGVyLWRhdGE9InsmcXVvdDtpc1BhaW50aW5nTGF5ZXImcXVvdDs6dHJ1ZX0iIGZpbGwtcnVsZT0ibm9uemVybyIgc3Ryb2tlLWxpbmVqb2luPSJtaXRlciIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiBzdHJva2UtZGFzaGFycmF5PSIiIHN0cm9rZS1kYXNob2Zmc2V0PSIwIiBzdHlsZT0ibWl4LWJsZW5kLW1vZGU6IG5vcm1hbCI+PHBhdGggZD0iTTIyNS4wNjY5NywxNzkuNWMwLC03Ljk3MTE0IDYuNDYxODksLTE0LjQzMzAzIDE0LjQzMzAzLC0xNC40MzMwM2M3Ljk3MTE0LDAgMTQuNDMzMDMsNi40NjE4OSAxNC40MzMwMywxNC40MzMwM2MwLDcuOTcxMTQgLTYuNDYxODksMTQuNDMzMDMgLTE0LjQzMzAzLDE0LjQzMzAzYy03Ljk3MTE0LDAgLTE0LjQzMzAzLC02LjQ2MTg5IC0xNC40MzMwMywtMT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ZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+PHBhdGggZD0iTTIzNi44OTU5MSwxODIuNzMyNTJsMi4wNzQyOCwtMi4wNzQyOCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmZmZmZmIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIvPjxwYXRoIGQ9Ik0yMzkuODUzNDcsMTc0Ljk1Nzc1bC0yLjA3NDI4LC0yLjA3NDI4IiBmaWxsPSJub25lIiBzdHJva2U9IiNmZmZmZmYiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+PHBhdGggZD0iTTI0Ni40NTM4LDE4MS41NTgwOGwtMi4wNzQyOCwtMi4wNzQyOCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmZmZmZmIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIvPjxwYXRoIGQ9Ik0yMjYuODk3MjUsMTkzLjEwMjc1di0yNi4yMDU1MWgyNi4yMDU1MXYyNi4yMDU1MXoiIGZpbGw9Im5vbmUiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSJub25lIiBzdHJva2UtbGluZWNhcD0iYnV0dCIvPjwvZz48L2c+PC9zdmc+PCEtLXJvdGF0aW9uQ2VudGVyOjEzLjEwMjc1NDg1NDYyMTI4MToxMy44NjIxNDc1NDY3MTM3NDMtLT4=";
menuIconURI: ico,
color1: "#5cb1d6",
color2: "#3ba2ce",
color3: "#2e8eb8",
id: 'multiTouchDetection',
name: 'Multi-Touch Detection',
blocks: [
{
opcode: 'isTouchingFinger',
blockType: Scratch.BlockType.BOOLEAN,
text: 'is touching finger?',
blockIconURI: touchIco,
filter: [Scratch.TargetType.SPRITE],
},
{
opcode: 'isSpecificFingerTouching',
blockType: Scratch.BlockType.BOOLEAN,
text: 'is finger [INDEX] touching?',
blockIconURI: touchIco,
arguments: {
INDEX: {
type: Scratch.ArgumentType.NUMBER,
defaultValue: 1,
},
},
filter: [Scratch.TargetType.SPRITE],
},
{
opcode: 'getTouchX',
blockType: Scratch.BlockType.REPORTER,
text: 'touch [INDEX] X position',
blockIconURI: touchIco,
arguments: {
INDEX: {
type: Scratch.ArgumentType.NUMBER,
defaultValue: 1,
},
},
filter: [Scratch.TargetType.SPRITE],
},
{
opcode: 'getTouchY',
blockType: Scratch.BlockType.REPORTER,
text: 'touch [INDEX] Y position',
blockIconURI: touchIco,
arguments: {
INDEX: {
type: Scratch.ArgumentType.NUMBER,
defaultValue: 1,
},
},
filter: [Scratch.TargetType.SPRITE],
}
]
};
}
})(Scratch); `
Beta Was this translation helpful? Give feedback.
All reactions