mrmop / booty5 Goto Github PK
View Code? Open in Web Editor NEWHTML5 JavaScript game engine that accompanies the Booty5 game editor
Home Page: http://booty5.com
License: Other
HTML5 JavaScript game engine that accompanies the Booty5 game editor
Home Page: http://booty5.com
License: Other
The following snippet does not work if using standard HTML audio (not using web audio and not using marmalade):-
var sound = new b5.Sound("explosion", "Explode.mp3", true );
sound.play();
Here is the fix:-
//Fixed version of sound play function
b5.Sound.prototype.play = function()
{
if (b5.app.use_web_audio)
{
if (this.buffer === null)
return null;
var context = b5.Sound.context;
var source = context.createBufferSource();
var gain = context.createGain();
source.buffer = this.buffer;
source.loop = this.loop;
source.connect(gain);
gain.connect(context.destination);
gain.gain.value = 1;
source.start(0);
if (this.auto_play)
this.snd = { source: source, gain: gain };
return { source: source, gain: gain };
}
var snd = null;
if (this.reuse)
snd = this.snd;
if (snd === null)
{
//fix
this.load();
snd = this.snd;
//fix
}
if (snd !== null) {
snd.play();
}
return snd;
};
Mistake on my part, closed.
I use Booty5 mostly in DroidScript, so i'm familiarized with the image methods of it.
So i want to know if Booty5 have any methods to adjust hue, saturation and brightness. Also copying drawn images from an actor. If not, can you add it?
"Whilst layers can be used to visually order the order in which visible scenes are overlaid, where layers are not used you can bring actors to the front of the visual stack or send them to the back using b5.Scene.bringToFront() and b5.Scene.sendToBack()."
you meant to say actor.bringToFront()/sendToBack().
Online API docs say "Material restitution, lower values make he object more bouncy" but it should be the opposite.
The online API docs for actor.addFixture describe 'points' not 'vertices' as an option. The code expects 'vertices'
This works:-
//Ground actor.
var ground = new b5.PolygonActor();
ground.name = "polygon1";
ground.points = [-200,500, 200,500, 200,540, -200,540];
ground.fill_style = "green";
ground.filled = true;
scene.addActor( ground );
//Ground Physics.
ground.initBody( "static", false, false );
ground.addFixture( {type:b5.Shape.TypePolygon, vertices:ground.points} );
Can it be standardized to set_canvas_scaling_method ?
Or is this because functions are named like these throughout and properties and labeled via under_score ?
Thanks.
Hello Mat, I am using Booty5 in my teaching but my students keep getting Booty5 run error message below:
You cannot start application Booty5 from this location because it is already installed from a different location
How can someone resolve this issue?
Why is not possible to run Booty5 at any time?
Does it write to registry or user folder on Windows?
Can it be run standalone non install on Windows for student uses?
Please help!
God blesses!!!
Best regards,
Sanyaade
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Booty 5</title>
<style type="text/css">
body
{
background-color: #666;
width: 1024px;
height: 576px;
}
</style>
<script src="booty5_min.js"></script>
<script>
window.addEventListener("load", on_init);
function on_init(event)
{
window.removeEventListener("load", on_init);
//Initialize Booty5
var app = new b5.App(document.getElementById("Booty5_Canvas"), true);
b5.app = app;
app.debug = true;
app.target_frame_rate = 24;
app.setCanvasScalingMethod(b5.App.FitBest);
//Scene Stuff:
var scene = new b5.Scene();
scene.name = "main scene";
app.addScene(scene);
app.onResize = function()
{
trace ("Why is this constantly being triggered ?");
}
app.waitForResources();
var actor = new b5.ArcActor();
actor.fill_style = "rgb(80,20,255)";
actor.radius = 30;
actor.x = actor.y = 1;
actor.vx = 1;
scene.addActor(actor);
}
function trace(arg)
{
console.log(arg);
}
</script>
</head>
<body>
<canvas id="Booty5_Canvas"></canvas>
</body>
</html>
Sometimes when you resize the browser, you will see "double vision" for the circle sprite...and also...is x = 0 suppose to be at the center instead of the top left which is the standard for Flash ?
Documentation says: It has scene.destroy(); but it's a little inconsistent not to have app.destroyScene(scene) or even better that and app.removeAndDestroyScene(scene).
Because if you don't do that, it leads to many internal questions/unknowns.
Do you have to remove the scene via app.removeScene and then scene.destroy later ? [This is syntaxtually not very beautiful.]
And what happen when you call scene.destroy without first calling app.removeScene ?
Does it holds a null bug waiting to happen then since it still technically holds a scene that is no longer there ?
All these could be eliminated if app.destroyScene(scene) and app.removeAndDestroyScene(scene) is implemented.
Please correct me if I am wrong thank you because I am learning and trying to make everything consistent in my mind :-)
Another case in point, you have:
scene.addResource(material, "Material");
scene.findResource("static_bounce", "Material");
scene.destroyResource("static_bounce", "Material"); //or material.destroy(); if you already have access to the material directly.
So for consistency sake, you have app.addScene, app.findScene but scene.destroy() but no app.destroyScene() is consistently wise a little strange I think.
Cause if you don't have that you will have to iterate through via a bunch of actor.destroy(); anyway after scene.removeActorsByTag("monsters"); if circumstances permits.
7 May 2020:
This is as barebone as it gets, I just load it, haven't even do anything with it yet and firefox give me that error :-(
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Booty 5</title>
<script src="booty5_min.js"></script>
<script>
window.addEventListener("load", on_init);
function on_init(event)
{
window.removeEventListener("load", on_init);
trace ("Hello !");
}
function trace(arg)
{
console.log(arg);
}
</script>
</head>
<body>
</body>
</html>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.