Skip to content
TemporalFuzz edited this page Oct 12, 2017 · 11 revisions

Hello There!

Welcome to the KAPhy wiki! Here is where you'll find documentation, tips, and general information on what has been accomplished so far. Make sure to hit that "Watch" button if you want to stay updated!

What is KAPhy?

KAPhy started as a physics engine (hence the name, KA Physics). However, it's grown into much, much more, coming with canvas configuration and drawing commands. KAPhy is currently a library that allows you to do pretty much everything you can in the PJS environment, and more!

Why did you make KAPhy? Why should I use it?

Well, KAPhy is designed to reimagine how games are developed on KA. No longer will all the best games on KA need to be in PJS! KAPhy, if not better than the KAPJS environment yet, will soon become equally or more powerful! Make sure to hit that watch button if you want to stay updated!

How can I help?

Well, first of all, you can join my discord server. We can sort out the specifics here, but feel free to make pull requests in the meantime! I'll review them and see if they should be added.

How do I add KAPhy to my webpage?

  1. Add <script type="text/javascript" src="https://rawgit.com/TemporalFuzz/KAPhy/master/kaphy.min.js"></script> to the head of your webpage.
  2. Add <canvas id="CANVAS_ID_HERE" style="margin:auto;background-color:#FFF;display:block">You don't have canvas support! Try switching to a different browser.</canvas> to the body. This defines the canvas element with the right styling and content.
  3. In a script tag, you can call KAPhy.load(fn). fn is a function that will be called when KAPhy is done loading. It's advised only to have one of these functions in your JS, and there's no reason to have more.
  4. Within fn, add this code:
var canvasEl = document.getElementById("CANVAS_ID_HERE");
KAPhy.Canvas.configure(canvasEl);
KAPhy.Canvas.resize(400, 400);

This code tells KAPhy which element to use (in case there are multiple). Canvas.resize(xDimension, yDimension) then resizes the canvas.

Within fn, everything in KAPhy will be defined, and you can use all of KAPhy's functionality.