갬쿠
개미 개발
갬쿠
전체 방문자
오늘
어제
  • ALL (137)
    • React (20)
    • JS & CSS & HTML (29)
    • Algorithm (62)
    • 웹 보안 (11)
    • 달리는 까까: 쿠키런 팬게임 (10)
    • Python (0)
    • 기타 (5)
    • 비공개 플젝 (0)

블로그 메뉴

  • GitHub
  • 방명록
  • 관리자 메뉴

공지사항

인기 글

태그

  • 게임
  • 달리는 까까
  • transform
  • REACT
  • useEffect
  • 모의 해킹
  • Python
  • Object
  • 쿠키런 팬게임
  • 백준
  • 쿠키런
  • JavaScript
  • 크롬 공룡게임
  • 리액트
  • 게임 개발
  • node.js
  • BEAKJOON
  • HTML
  • useState
  • useReducer
  • 크롬 공룡 게임
  • Baekjoon
  • 쿠키런 모작
  • js
  • Programmers
  • CSS
  • Best of the Best
  • 객체
  • SQL Injection
  • EventListener

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
갬쿠

개미 개발

[달리는 까까] UI 개선
달리는 까까: 쿠키런 팬게임

[달리는 까까] UI 개선

2022. 6. 5. 17:47

기존 alert()나 confirm()을 이용해 다음 스테이지 이어달리기 또는 로비로 돌아가기 기능을 구현했었다. 기능은 잘 동작하지만 전체 UI와 맞지 않는 디자인이다 보니 이질감이 생겼다. 이번에는 쿠키런과 비슷한 디자인으로 확인창을 디자인 해봤다.

 

완성된 확인창

 

확인창을 띄우는 방법은 paused 박스나 crash_filter를 띄우는 방식과 동일하다. 확인창을 디자인한 후 display: none;으로 설정하고, 스테이지를 클리어하면 display: block;으로 변경하면 된다.

기존에 alert()과 confirm()을 사용할 때와 내부적인 코드는 동일하기 때문에 금방 만들 수 있었다.

const nextStage = () => {
  cookie.movex = 0;
  gameBackground.gameBox.style.transform = `translateX(${0}px)`;

  allJellyComProp.arr.forEach((j) => {
    j.el.remove();
  });
  allJellyComProp.arr.splice(0); //배열 요소 전부 삭제

  allObstacleComProp.arr.forEach((o) => {
    o.el.remove();
  });
  allObstacleComProp.arr.splice(0);

  allItemComProp.arr.forEach((i) => {
    i.el.remove();
  });
  allItemComProp.arr.splice(0);

  newStage = new Stage(stageInfo.stage[stageInfo.currentStageIndex]);
  stageInfo.currentStage = newStage;

  gameProp.gameClear = false;
  document.querySelector(".stage_guide").style.display = "none";
};

const backLobby = () => {
  cookie.movex = 0;
  gameBackground.gameBox.style.transform = `translateX(${0}px)`;

  allJellyComProp.arr.forEach((j) => {
    j.el.remove();
  });
  allJellyComProp.arr.splice(0);

  allObstacleComProp.arr.forEach((o) => {
    o.el.remove();
  });
  allObstacleComProp.arr.splice(0);

  allItemComProp.arr.forEach((i) => {
    i.el.remove();
  });
  allItemComProp.arr.splice(0);

  location.href = "index.html";
  document.querySelector(".stage_guide").style.display = "none";
};

 

모든 스테이지를 클리어했을 때는 다른 확인창을 띄운다.

 

 


🔻모든 코드 보기🔻

https://github.com/mkthebea/CCKK_Run.git

 

GitHub - mkthebea/CCKK_Run: A fangame of [CookieRun: Ovenbreak]

A fangame of [CookieRun: Ovenbreak]. Contribute to mkthebea/CCKK_Run development by creating an account on GitHub.

github.com

🔻게임 하기🔻

https://mkthebea.github.io/CCKK_Run/

 

DAL GGA

Loading... No Record Bronze Silver Gold Ruby Diamond Rainbow

mkthebea.github.io

 

728x90

'달리는 까까: 쿠키런 팬게임' 카테고리의 다른 글

[달리는 까까] 맵 제작하기  (0) 2022.06.05
[달리는 까까] 아이템 추가  (0) 2022.06.02
[달리는 까까] 스테이지 이어 달리기  (0) 2022.06.02
[달리는 까까] 이미지 사전 로드와 로딩 페이지  (0) 2022.05.31
[달리는 까까] 메인 화면을 로비로 만들기  (0) 2022.05.31
    '달리는 까까: 쿠키런 팬게임' 카테고리의 다른 글
    • [달리는 까까] 맵 제작하기
    • [달리는 까까] 아이템 추가
    • [달리는 까까] 스테이지 이어 달리기
    • [달리는 까까] 이미지 사전 로드와 로딩 페이지
    갬쿠
    갬쿠
    보안&소프트웨어 전공 프론트엔드 개발자

    티스토리툴바