Code 9leap에서 가장 먼저 표시된 "START"삭제
8090 단어 enchant.jscode9leap
최초의 START가 필요 없을 때.
code9leap에서 실행할 때 반드시 화면 중앙의 "START"를 표시합니다.
여기를 클릭하면 게임 화면을 활성화하려는 시도가 있을 수 있지만 상황에 따라 필요하지 않을 수도 있습니다...
'스타트'는 나일레프다.enchant.js로 표시하다
그래서 index.> 의 nineleap.enchant.js를 읽는 부분에 대해 평론을 하면 해결됩니다.<!doctype html>
<html>
<head>
<link rel='stylesheet' href='style.css' type='text/css'>
<script src='/static/enchant.js-latest/enchant.js'></script>
<!-- <script src='/static/enchant.js-latest/plugins/nineleap.enchant.js'></script>-->
<script src='/code.9leap.js'></script>
<script src='main.js'></script>
<title>Page title</title>
</head>
<body>
</body>
</html>
게임 시작 후의 경과 시간을 표시하고 싶습니다.
그런데 왜 이런 일을 했을까, 시작한 후의 경과 시간을 측정하려는 것이다.
기본적으로 표시된'START'를 얻는 시간이 복잡해 보이기 때문에 기본적으로 표시된 쪽이 사라지고 오리지널 단추를 꺼내는 것이 간단하다고 판단해 테스트를 진행했다.enchant();
window.onload = function(){
var game = new Core(320, 320);
var timeflg = false;
var time;
game.fps = 15;
game.preload("start.png");
game.onload = function(){
// 時間表示用
var label = new Label("push start");
label.x = 70;
label.y = 100;
label.font = "30px Sans-Serif";
game.rootScene.addChild(label);
// スタートボタン
var button = new Sprite(230,50);
button.image = game.assets["start.png"];
button.x = 40;
button.y = 260;
game.rootScene.addChild(button);
// ボタンが押されたらフラグをTrueにする
button.addEventListener("touchend",function()
{
console.log(timeflg);
time = 0;
timeflg = true;
game.rootScene.removeChild(button);
});
game.addEventListener('enterframe', function() {
// Trueのときだけカウントアップ
if(timeflg)
{
time++;
label.text = Math.floor(time / game.fps);
}
});
};
game.start();
};
code9leap의 샘플 항목 (Chrome에서 일하게 해 주세요).
http://code.9leap.net/codes/show/164403
Reference
이 문제에 관하여(Code 9leap에서 가장 먼저 표시된 "START"삭제), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/takako_sudou/items/6b877e12e5fa2d5eb50b
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
그래서 index.> 의 nineleap.enchant.js를 읽는 부분에 대해 평론을 하면 해결됩니다.
<!doctype html>
<html>
<head>
<link rel='stylesheet' href='style.css' type='text/css'>
<script src='/static/enchant.js-latest/enchant.js'></script>
<!-- <script src='/static/enchant.js-latest/plugins/nineleap.enchant.js'></script>-->
<script src='/code.9leap.js'></script>
<script src='main.js'></script>
<title>Page title</title>
</head>
<body>
</body>
</html>
게임 시작 후의 경과 시간을 표시하고 싶습니다.
그런데 왜 이런 일을 했을까, 시작한 후의 경과 시간을 측정하려는 것이다.
기본적으로 표시된'START'를 얻는 시간이 복잡해 보이기 때문에 기본적으로 표시된 쪽이 사라지고 오리지널 단추를 꺼내는 것이 간단하다고 판단해 테스트를 진행했다.enchant();
window.onload = function(){
var game = new Core(320, 320);
var timeflg = false;
var time;
game.fps = 15;
game.preload("start.png");
game.onload = function(){
// 時間表示用
var label = new Label("push start");
label.x = 70;
label.y = 100;
label.font = "30px Sans-Serif";
game.rootScene.addChild(label);
// スタートボタン
var button = new Sprite(230,50);
button.image = game.assets["start.png"];
button.x = 40;
button.y = 260;
game.rootScene.addChild(button);
// ボタンが押されたらフラグをTrueにする
button.addEventListener("touchend",function()
{
console.log(timeflg);
time = 0;
timeflg = true;
game.rootScene.removeChild(button);
});
game.addEventListener('enterframe', function() {
// Trueのときだけカウントアップ
if(timeflg)
{
time++;
label.text = Math.floor(time / game.fps);
}
});
};
game.start();
};
code9leap의 샘플 항목 (Chrome에서 일하게 해 주세요).
http://code.9leap.net/codes/show/164403
Reference
이 문제에 관하여(Code 9leap에서 가장 먼저 표시된 "START"삭제), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/takako_sudou/items/6b877e12e5fa2d5eb50b
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
enchant();
window.onload = function(){
var game = new Core(320, 320);
var timeflg = false;
var time;
game.fps = 15;
game.preload("start.png");
game.onload = function(){
// 時間表示用
var label = new Label("push start");
label.x = 70;
label.y = 100;
label.font = "30px Sans-Serif";
game.rootScene.addChild(label);
// スタートボタン
var button = new Sprite(230,50);
button.image = game.assets["start.png"];
button.x = 40;
button.y = 260;
game.rootScene.addChild(button);
// ボタンが押されたらフラグをTrueにする
button.addEventListener("touchend",function()
{
console.log(timeflg);
time = 0;
timeflg = true;
game.rootScene.removeChild(button);
});
game.addEventListener('enterframe', function() {
// Trueのときだけカウントアップ
if(timeflg)
{
time++;
label.text = Math.floor(time / game.fps);
}
});
};
game.start();
};
Reference
이 문제에 관하여(Code 9leap에서 가장 먼저 표시된 "START"삭제), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/takako_sudou/items/6b877e12e5fa2d5eb50b텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)