Code Monkey home page Code Monkey logo

p5js-screenscroller's Introduction

ScreenScrollerクラスを使ってのスクロール

ScreenScrollerはStudio Kuraで小学生以上向けに開発された簡易スクロールエンジンです。

設定するだけで、setupdrawにあまりコードを加えることなく使えるようにできています。

使い方

  • このリポジトリーを踏み台にして使う場合: フォーク・クローン・ダウンロードしてください
  • 既存のプロジェクトに導入する場合:
    1. ScreenScroller.jsset_options.jsをプロジェクトに含めて、既存のプロジェクトのindex.htmlなどでsketch.jsと同じように呼び出す
    2. 既存のプロジェクトのsketch.jsでこのリポジトリーのsketch.jsと同じように
      1. screen変数を用意する
      2. setup()の中でset_options()を呼び出す
      3. draw()の中でscreen.draw()を呼び出す
      4. スクロールのきっかけscreen.initiate_scroll('right')を適当な個所で呼び出す(up, right, down, left)
    3. p5.js公式エディターで使う場合はここから編集する

index.htmlで全ての

設定したいオプション

  • tile_engine: タイルの書き方や中身を設定するオブジェクト。その中にあるのは:
    • tiles: 色のHEX文字列(白が#ffffffなど)や絵文字を使ってタイルの中身を指定します
    • tile_draw_function: タイルの一つ一つを画面に描く関数(絵文字ようの関数と、単色四角の関数は用意されています)
  • stages: ゲームの中で一つ一つの面のタイル配置を配列にしたもの(タイルを横に並べた行の配列が1面で、面の配列であるstagesがゲーム全ての面を表す)
  • scroll_map: このゲームの世界でのstagesの位置関係。ゲームは0から始まります。

参考資料

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.