问题标签 [construct-2]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
html - 将 Html5 游戏(如 Webview 画布)结合到 adobe flash/animate
我有一个关于将两个项目合并为一个项目的特殊问题,基本上是用不同的引擎制作的。
几年前我用 flash/animate 做了一个项目。目前我正在使用construct2。在 Flash 中,可以使用 webview 画布包含网站。是否有可能在construct2中创建一个游戏,将其导出为html5项目,并在我的flash应用程序中显示/包含它?所以我不必用不同的引擎创建两次?
如果我可以将本地 html5 游戏 (construct2) 包含到我的 adobe flash/animate 游戏中,那就太棒了。
游戏应该放在项目环境中,所以你不需要有互联网连接。这就是要求。
(这只是一个想法,我不确定它是否可能,这就是为什么我要在这里问,然后我必须在 as3 中创建我在construct2 中制作的相同游戏。)
非常感谢您的回答!我很高兴你的投入,
干杯!
javascript - 从导出的脚本编辑变量 - 构造 2
我想从在构造 2 中设计并导出到 html5 游戏的脚本中访问或编辑游戏变量
导出时会创建data.js和c2runtime.js
data.js由游戏代码和变量组成。
基于上面的代码,我能够使用下面的代码访问全局变量(感谢 scirra 的 Yann),但无法编辑嵌套的其他值。像 player.hp 或 player.money
android - Cordova平台添加android错误(构造2)
apk 文件,其中包含通过 Cordova 导出的两个项目
我打开 cmd 然后我使用导出的项目到达我的文件夹,当我尝试使用 cmd 添加 android - “cordova platform add android”
我明白了:
'在 config.xml 中发现插件“cordova-custom-config”。将其添加到项目无法从 config.xml 恢复插件“cordova-custom-config”。您可能需要再次尝试添加它。错误:无法通过注册表获取插件 cordova-custom-config。这可能是连接问题,或者插件规范不正确。检查您的连接和插件名称/版本/URL。错误:cmd:命令失败,退出代码 1 错误输出:npm ERR!代码 ENOGIT npm 错误!在 $PATH npm ERR 中找不到 git 二进制文件!npm 错误!使用 git 失败。npm 错误!请检查您是否安装了 git 并在您的 PATH 中。
有人能帮我吗?
javascript - Javascript $.GET - 访问控制允许来源错误
我尝试从不同的站点收集 html 文本,然后搜索这些站点是否包含我的 pub-id。问题是我无法访问其他网站,因为 Access-Control-Allow-Origin。
无法加载http://example.com/ :从“ http://example.com/ ”重定向到“ http://example.com/ ”已被 CORS 策略阻止:否“Access-Control-Allow-” Origin' 标头存在于请求的资源上。因此,不允许访问源“ http://localhost:50000 ”。
在这里你可以看看我的代码:
此代码已添加到我的 Construct 2 项目中。更有趣的是,如果我将在 NW.js 中运行/预览我的游戏,代码就可以工作。如果我将在 Chrome、Firefox、Edge 等中预览/运行,代码将不起作用。
有人知道如何解决这个问题吗?我知道我需要向该服务器发出请求,但我不知道如何。
谢谢!
PS:如果您知道在 Javascript 或 Construct 2 中进行此操作的其他方法,我会全力以赴。
php - Send and save data to php with construct2
Im trying the past 2 weeks to send and save data to a php but with no luck. So, my goal is , to give the ability to users have download my app from playstore to can vote if they agree or not for something in the app. To do that i put a yes sigh and a no sign , when the user press the yes sign , a vote go to php file and save so all the users can see the results. I make a php
and i send a "POST" whith AJAX on construct2 to URL "https://sirmobilegames.000webhostapp.com/Vote1.php?getdata=gettest"
and the data "postdata=" & URLEncode(ta)
"ta" is a variable in construct with value 1.
and i use METHOD: POST
After i export this to NW.js i run it and when i press the button it says postdata: 1 , getdata: get data not set if i press it once again postdata: 2 , getdata: get data not set so it update the postdata but when i close the app and open it again im trying to read the postdata and i get postdata: post data not set , getdata: get data not set.
Why it cant save the variable i send it.
html - Web HTML 游戏无法在三星电视 HG32EE590 上运行
此游戏 HTML5 链接不适用于此三星电视 HG32EE590。
加载需要很长时间 - 然后只显示黑屏。
游戏是在 Construct 2 中构建的(我知道不是很好!)
但我已将游戏导出为 HTML5。
如果有人对此有任何经验并可以提供帮助,请与我联系。
android - 为什么我的 APK 在同一个 Android 版本上运行的性能不同?
我使用 Construct 2 + CLI Cordova + Android Studio(目标 SDK 27,最小 SDK 21)构建了一个简单的游戏(APK),然后在两台设备上进行测试:
- 三星 i9082 (Lolipop - cust rom):性能缓慢
- 华硕(棒棒糖):表现不错
*当我使用 Phonegapp 构建它时,结果相同。
这是否意味着旧设备不再支持使用此配置运行 APK?还是有其他解释/解决方案?
javascript - 在构造 2 html 画布上禁用点击事件传播
我有一个construct 2 游戏导出文件,我在其中附加了一个html 文件。我想禁用构造 2 游戏动态生成的画布的触摸/单击事件,因为当我单击附加的 html 时,单击也会传播到游戏的画布元素。
我使用了 event.stopPropagation() 和 event.preventDefault() 函数,但无济于事。
construct-2 - 如何计算文本精灵的宽度?
我需要很好地包装文本。例如,“WWWW WWWW”比“1111 1111”占用更多空间。我有一个设计来制作一个 for 循环并逐个添加单词,看看文本是否太长而无法容纳该行。
如何正确计算 text.textWidth() 而不将文本绘制到屏幕上?
System.Wait() 似乎需要刷新 textwidth 值,有什么解决方法吗?我不想将睡眠添加到 for 循环中,这需要很长时间。