-
Notifications
You must be signed in to change notification settings - Fork 0
Guide Beginner Overview
Carlonn Rivers edited this page Jul 21, 2021
·
7 revisions
Things you should know before starting:
HTML, JavaScript
The beginner guide will give you an introduction to the following:
Scenes, Prefab, Sprites
Here's an idea of what we will be creating in this section:
You can refer to this code while following the guide:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>First FlevaR Application</title>
<!-- include our engine -->
<script src="https://unpkg.com/[email protected]/dist/flevar.js"></script>
<!-- include main application script -->
<script defer src="main.js"></script>
</head>
<body>
<!-- container for our application -->
<div id="flevaRContainer"></div>
</body>
</html>
const flevaRContainerElement = document.getElementById("flevaRContainer");
FlevaR(flevaRContainerElement, function onload(flevar) {
const _root = flevar._root;
flevar.createSprite("first_sprite");
flevar.createPrefab("first_prefab", function onload(prefab) {
prefab._x = 50;
prefab._y = 100;
prefab.setAppearance(function (prefab) {
prefab.useSprite("first_sprite");
});
});
flevar.createScene("first_scene", function onload(scene) {
scene.addPrefab("first_prefab");
});
flevar.useScene("first_scene");
_root._color = "green";
});