Commit dfcc0521 authored by Guillaume C.'s avatar Guillaume C.

Ajout de l'éxécutable HTML5

parent ebe57bb9
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{
"formatVersion": 2,
"isBitmap": false,
"filtering": "pixelated",
"pixelsPerUnit": 1,
"size": 32,
"color": "ffffff",
"opacity": null,
"gridWidth": 16,
"gridHeight": 16,
"charset": null,
"charsetOffset": 32
}
\ No newline at end of file
{
"formatVersion": 1,
"nodes": [
{
"id": "0",
"name": "Camera",
"children": [],
"components": [
{
"type": "Camera",
"config": {
"mode": "orthographic",
"fov": 45,
"orthographicScale": 720,
"viewport": {
"x": 0,
"y": 0,
"width": 1,
"height": 1
},
"depth": 0,
"nearClippingPlane": 0.1,
"farClippingPlane": 1000,
"formatVersion": 1
},
"id": "0"
}
],
"position": {
"x": 640,
"y": 360,
"z": 5
},
"orientation": {
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"scale": {
"x": 1,
"y": 1,
"z": 1
},
"visible": true,
"layer": 0,
"prefab": null
},
{
"id": "1",
"name": "Balle",
"children": [],
"components": [
{
"type": "SpriteRenderer",
"config": {
"spriteAssetId": "6",
"animationId": null,
"horizontalFlip": false,
"verticalFlip": false,
"castShadow": false,
"receiveShadow": false,
"color": "ffffff",
"overrideOpacity": false,
"opacity": null,
"materialType": "basic",
"shaderAssetId": null,
"formatVersion": 1
},
"id": "0"
},
{
"type": "ArcadeBody2D",
"config": {
"type": "box",
"movable": true,
"width": 20,
"height": 20,
"offset": {
"x": 0,
"y": 0
},
"tileMapAssetId": null,
"tileSetPropertyName": null,
"layersIndex": null,
"formatVersion": 2,
"bounce": {
"x": 0,
"y": 0
}
},
"id": "1"
},
{
"type": "Behavior",
"config": {
"behaviorName": "CmpBalle",
"propertyValues": {}
},
"id": "2"
}
],
"position": {
"x": 640,
"y": 360,
"z": 0
},
"orientation": {
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"scale": {
"x": 1,
"y": 1,
"z": 1
},
"visible": true,
"layer": 0,
"prefab": null
},
{
"id": "2",
"name": "J1",
"children": [],
"components": [
{
"type": "SpriteRenderer",
"config": {
"spriteAssetId": "5",
"animationId": null,
"horizontalFlip": false,
"verticalFlip": false,
"castShadow": false,
"receiveShadow": false,
"color": "ffffff",
"overrideOpacity": false,
"opacity": null,
"materialType": "basic",
"shaderAssetId": null,
"formatVersion": 1
},
"id": "0"
},
{
"type": "ArcadeBody2D",
"config": {
"type": "box",
"movable": true,
"width": 20,
"height": 100,
"offset": {
"x": 0,
"y": 0
},
"tileMapAssetId": null,
"tileSetPropertyName": null,
"layersIndex": null,
"formatVersion": 2,
"bounce": {
"x": 0,
"y": 0
}
},
"id": "1"
},
{
"type": "Behavior",
"config": {
"behaviorName": "CmpJ1",
"propertyValues": {}
},
"id": "2"
}
],
"position": {
"x": 100,
"y": 360,
"z": 0
},
"orientation": {
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"scale": {
"x": 1,
"y": 1,
"z": 1
},
"visible": true,
"layer": 0,
"prefab": null
},
{
"id": "3",
"name": "J2",
"children": [],
"components": [
{
"type": "SpriteRenderer",
"config": {
"spriteAssetId": "5",
"animationId": null,
"horizontalFlip": false,
"verticalFlip": false,
"castShadow": false,
"receiveShadow": false,
"color": "ffffff",
"overrideOpacity": false,
"opacity": null,
"materialType": "basic",
"shaderAssetId": null,
"formatVersion": 1
},
"id": "0"
},
{
"type": "ArcadeBody2D",
"config": {
"type": "box",
"movable": true,
"width": 20,
"height": 100,
"offset": {
"x": 0,
"y": 0
},
"tileMapAssetId": null,
"tileSetPropertyName": null,
"layersIndex": null,
"formatVersion": 2,
"bounce": {
"x": 0,
"y": 0
}
},
"id": "1"
},
{
"type": "Behavior",
"config": {
"behaviorName": "CmpJ2",
"propertyValues": {}
},
"id": "2"
}
],
"position": {
"x": 1180,
"y": 360,
"z": 0
},
"orientation": {
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"scale": {
"x": 1,
"y": 1,
"z": 1
},
"visible": true,
"layer": 0,
"prefab": null
},
{
"id": "4",
"name": "Score",
"children": [],
"components": [
{
"type": "TextRenderer",
"config": {
"formatVersion": 2,
"fontAssetId": "7",
"text": "Text",
"alignment": "center",
"verticalAlignment": "center",
"size": null,
"color": null,
"overrideOpacity": false,
"opacity": null
},
"id": "0"
},
{
"type": "Behavior",
"config": {
"behaviorName": "CmpScore",
"propertyValues": {}
},
"id": "1"
}
],
"position": {
"x": 640,
"y": 690,
"z": 0
},
"orientation": {
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"scale": {
"x": 1,
"y": 1,
"z": 1
},
"visible": true,
"layer": 0,
"prefab": null
}
]
}
\ No newline at end of file
class ComportementsBehavior extends Sup.Behavior {
awake() {
}
update() {
}
}
Sup.registerBehavior(ComportementsBehavior);
const VITBALLE = 3; // Vitesse de base de la balle
let scoreJ1 = 0;
let scoreJ2 = 0;
let ecran = Sup.Input.getScreenSize();
let activeJ1 =false;
function Tactile(num : number) {
//Sup.log("tactile " + this.actor.getY());
let ydoigtJ = Sup.Input.getTouchPosition(num).y;
let proportion= ((Sup.Input.getTouchPosition(num).y +1)/2);
let nvposy = proportion*ecran.y;
return nvposy;
}
class CmpJ1 extends Sup.Behavior { // Comportement du J1
awake() {
//Sup.log("awake " + this.actor.getY());
}
update() {
//Sup.log("update " + this.actor.getY());
let velJ1= this.actor.arcadeBody2D.getVelocity(); // Récupère la vélocité du palet J1
velJ1.y = 0;
if(Sup.Input.isKeyDown("SHIFT") && this.actor.getY() < 670){
velJ1.y=10;
}
////////////////////////////////Tactile
if(Sup.Input.wasTouchStarted(0)){
activeJ1 = true;
}else if (Sup.Input.wasTouchEnded(0)){
activeJ1 =false;
}
//Sup.log("start :"+ Sup.Input.wasTouchStarted(0)+ " end : " + Sup.Input.wasTouchEnded(0));
if ( activeJ1 && (Sup.Input.getTouchPosition(0).x <= 0 ) ) {
let posyJ1 = Tactile(0);
this.actor.setY(posyJ1);
}
/////////////////////////////////
if(Sup.Input.isKeyDown("CONTROL") && this.actor.getY() > 50){
velJ1.y=-10;
}
//Sup.log("3 " + posyJ1);
this.actor.arcadeBody2D.setVelocity(velJ1);
this.actor.arcadeBody2D.warpPosition(this.actor.getX(),this.actor.getY());// équivaut au Return velJ1
} // ne pas oublier de l'appliquer à l'objet
}
Sup.registerBehavior(CmpJ1);
class CmpJ2 extends Sup.Behavior { // Comportement du J2
awake() {
}
update() {
let velJ2= this.actor.arcadeBody2D.getVelocity(); // Récupère la vélocité du palet J2
velJ2.y = 0;
if(Sup.Input.isKeyDown("UP") && this.actor.getY() < 670){
velJ2.y=10;
}
if(Sup.Input.isKeyDown("DOWN") && this.actor.getY() > 50){
velJ2.y=-10;
}
////////////////////////////////Tactile
if ((Sup.Input.wasTouchStarted(1) || !Sup.Input.wasTouchEnded(1)) && (Sup.Input.getTouchPosition(1).x > 0 ) ) {
let posyJ2 = Tactile(1);
this.actor.setY(posyJ2);
}
/////////////////////////////////
this.actor.arcadeBody2D.setVelocity(velJ2); // équivaut au Return velJ2
} // ne pas oublier de l'appliquer à l'objet
}
Sup.registerBehavior(CmpJ2);
class CmpBalle extends Sup.Behavior { // Comportement de la balle
vitesse = VITBALLE; // vitesse de la balle
sx = 1; // Sens de la balle à l'horizontal
sy = 1; // Sens de la balle à la verticale
awake() {
}
update() {
let velBalle = this.actor.arcadeBody2D.getVelocity();
if(Sup.ArcadePhysics2D.collides(this.actor.arcadeBody2D,Sup.ArcadePhysics2D.getAllBodies())){ // cogne une raquette
this.sx = this.sx * -1;
this.vitesse = this.vitesse + 1;
}
if(this.actor.getY() > 710 || this.actor.getY() < 10 ){ // cogne un mur
this.sy = this.sy * -1;
}
if(this.actor.getX() > 1280){
this.actor.arcadeBody2D.warpPosition(new Sup.Math.Vector3(640,360,0)); // Quand gain de point, remise balle au centre
this.vitesse = VITBALLE;
this.sx = this.sx * -1;
scoreJ1 = scoreJ1 + 1;
}
if(this.actor.getX() < 0){
this.actor.arcadeBody2D.warpPosition(new Sup.Math.Vector3(640,360,0)); // Quand gain de point, remise balle au centre
this.vitesse = VITBALLE;
this.sx = this.sx * -1;
scoreJ2 = scoreJ2 + 1;
}
velBalle.x = this.vitesse * this.sx;
velBalle.y = this.vitesse * this.sy;
this.actor.arcadeBody2D.setVelocity(velBalle);
}
}
Sup.registerBehavior(CmpBalle);
class CmpScore extends Sup.Behavior {
awake() {
}
update() {
this.actor.textRenderer.setText(scoreJ1 + " : " + scoreJ2);
}
}
Sup.registerBehavior(CmpScore);
{
"formatVersion": 3,
"maps": [
"map"
],
"filtering": "pixelated",
"wrapping": "clampToEdge",
"pixelsPerUnit": 1,
"framesPerSecond": 10,
"opacity": null,
"alphaTest": 0.1,
"frameOrder": "rows",
"grid": {
"width": 20,
"height": 20
},
"origin": {
"x": 0.5,
"y": 0.5
},
"animations": [],
"mapSlots": {
"map": "map",
"light": null,
"specular": null,
"alpha": null,
"normal": null
}
}
\ No newline at end of file
{
"formatVersion": 3,
"maps": [
"map"
],
"filtering": "pixelated",
"wrapping": "clampToEdge",
"pixelsPerUnit": 1,
"framesPerSecond": 10,
"opacity": null,
"alphaTest": 0.1,
"frameOrder": "rows",
"grid": {
"width": 20,
"height": 100
},
"origin": {
"x": 0.5,
"y": 0.5
},
"animations": [],
"mapSlots": {
"map": "map",
"light": null,
"specular": null,
"alpha": null,
"normal": null
}
}
\ No newline at end of file
This diff is collapsed.
*{min-width:0;min-height:0}html,body{height:100%}body{margin:0;display:flex;background:#000;-webkit-user-select:none;-moz-user-select:none;user-select:none;overflow:hidden}#loading{position:absolute;top:0;bottom:0;left:0;right:0;color:#444;font-size:24px;font-family:sans-serif;text-transform:uppercase;display:flex;flex-flow:column;align-items:center;justify-content:center;background:#eee;}#loading.end a{opacity:0}#loading.start a{opacity:1}#loading a{opacity:0;transition:opacity .3s ease-out;position:relative;text-decoration:none;color:inherit;}#loading a > *{pointer-events:none}#loading img{width:540px;height:160px;max-width:100%}#loading progress{background:#c4c8b7;border:none;width:calc(370% / 540 * 100);height:3px;position:absolute;bottom:26px;right:calc(30% / 540 * 100);}#loading progress::-webkit-progress-bar{background:#d0d4c3}#loading progress::-webkit-progress-value{background:#a5a49e}#loading progress::-moz-progress-bar{background:#a5a49e}#loading .error{text-align:center;padding:0 2em}canvas{flex:1;outline:none}
\ No newline at end of file
<!DOCTYPE html><html><head><meta charset="utf-8"><link rel="stylesheet" href="index.css"></head><body><canvas tabindex="-1"></canvas><div id="loading"><a href="http://superpowers-html5.com/" target="_blank"><img src="images/superpowers-splash.svg" draggable="false"><progress max="100" value="0"></progress></a></div><script src="SupCore.js"></script><script src="SupEngine.js"></script><script src="SupRuntime.js"></script></body></html>
\ No newline at end of file
{
"list": [
"common/documentation",
"common/home",
"common/settings",
"common/textEditorWidget",
"common/three",
"default/arcadePhysics2D",
"default/cubicModel",
"default/font",
"default/gameSettings",
"default/light",
"default/model",
"default/onlineDocumentation",
"default/projectSettings",
"default/scene",
"default/shader",
"default/sound",
"default/sprite",
"default/tileMap",
"default/transformHelpers",
"default/typescript",
"extra/cannonjs",
"extra/eventEmitter",
"extra/p2js",
"extra/rngjs",
"extra/socketio",
"extra/tweenjs"
],
"paths": {
"editors": {
"cubicModel": "default/cubicModel",
"font": "default/font",
"model": "default/model",
"scene": "default/scene",
"shader": "default/shader",
"sound": "default/sound",
"sprite": "default/sprite",
"tileMap": "default/tileMap",
"tileSet": "default/tileMap",
"script": "default/typescript"
},
"tools": {
"documentation": "common/documentation",
"main": "common/home",
"settings": "common/settings",
"apiBrowser": "default/typescript",
"search": "default/typescript"
}
}
}
\ No newline at end of file
This diff is collapsed.
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
"use strict";
function setupComponent(player, component, config) {
if (config.type === "box")
component.setupBox(config);
else if (config.type === "tileMap") {
config.tileMapAsset = player.getOuterAsset(config.tileMapAssetId);
if (config.tileMapAsset == null)
throw new Error("Arcade Physics Body doesn't have a tile map associated.");
config.tileSetAsset = player.getOuterAsset(config.tileMapAsset.__inner.data.tileSetId);
component.setupTileMap(config);
}
}
exports.setupComponent = setupComponent;
},{}],2:[function(require,module,exports){
"use strict";
var ArcadeBody2D = require("./ArcadeBody2D");
SupRuntime.registerPlugin("ArcadeBody2D", ArcadeBody2D);
},{"./ArcadeBody2D":1}]},{},[2]);
This diff is collapsed.
This diff is collapsed.