With plenty of free time over the holidays the hammers and chisels have been working hard to bring you Booty5 1.8.6b. We have a fair number of changes to both engine and editor as well as two new demos as well as most of the other demos updated, including Leapo.
- Added new property to Actor called merge_cache which when set to true will attempt to merge the actors rendering into a suitable parents cache. Note that once an actor has been merged into its parent its visual properties cannot be modified
- Add new property to TheApp called focus_scene2 which sets a 2nd scene as focus, this scene will be used for touch events if the first main focus scene does not respond to them
- Added support for fallback sound to Sound class via location2
- Added new min_panning property to Scene. This will prevent panning being marked as true if the movement distance squared is below this value
- Sound now supports looping via Sound.loop
- All Xoml parse functions now return the created object
- New Xoml.findResource() added which searched a Xoml resource collection for the named resource
- Fixed issue where Actor.current_frame was going out of bounds
- Fixed polygonActor gradient fill
- Examples updated
- New “Create Objects from Template” and “List Menu” demos added
- Added new property to Icon / Label called merge_cache which when set to true will attempt to merge the actors rendering into the a suitable parents cache
- Scene Current property has been renamed to the more appropriate “Has Focus”
- Scene has new property called Secondary Focus which sets a 2nd scene as focus, this scene will be used for touch events if the first main focus scene does not respond to them
- Added new “clone to all scenes” menu action which will clone an Icon / Label to all scenes
- Added new “delete from all scenes” menu action which will remove all Icons / Labels from all scenes that share the same name as the selected item
- Added new “copy to scene” menu action which will create a copy of the selected actor and copy it to the selected scene
- Added new “bring to front” and “send to back” commands to resources tree view
- Added new resource view text size change buttons which can be used to increase / decrease font size
- Added new Disable Shadows property to project properties. Setting to true will disable export of all shadows for all actors
- Added fall back audio file to sound properties, this file will be loaded if original one fails to load
- Added new loop property to sound which enables audio to be looped
- CocoonJS added to list of additional API’s (see project properties)
- Fix: Stopped menu appearing when pressing right mouse button on canvas
- Fixed bug that generated invalid JSON when exporting label children
Lets take a look at some of the changes in more detail.
In the last update we added support for the caching of primitives such as rounded rects / gradients so that they only get drawn the once, this can provide a hue speed boost especially on mobile devices. Merged caching takes that one step further by allowing child elements to be merged (drawn) into the cache of a cached parent that is higher up in the hierarchy. This allows you to render lots of complex actors into a single cache. Remember however that once merged into a parent it cannot be rotated, scaled or modified in any way.
Whilst writing Leapo I came across an issue where I wanted to be able to activate a pause button that was in the HUD scene, whilst still having the game scene have touch focus. To fix this I added a secondary focus property to scenes which effectively allows two scenes and the objects within those scenes to all receive input.
Audio Fall back and Looping
Whilst deploying Leapo across a number of different browsers and mobile devices I became aware that there doesn’t appear to be any standards for audio format support, so I have added a fall back option that allows a second audio file to be loaded if the first fails. It seems that most browsers / devices can be covered by supporting OGG and MP3. I have also added looping support, sounds can now be marked as loop to force them to replay when the sound finishes playing, this is ideal for background music.
I’ve modified the Xoml system to enable object cloning. Object cloning is basically creating a new copy of a resource that exists within the Xoml data. The Xoml data is the arrays /. objects that are exported from Booty5 and loaded and parsed when the game boots. This enables you to create multiple copies of the same object, including any child objects. I’ve added a simple demo that shows how to do this. Below is the code:
var app = window.app;
// This scene will receive a copy of ball object
var game_scene = app.findScene("gamescene");
// Search Xoml gamescene for ball icon actor resource
var ball_template = Xoml.findResource(window.gamescene, "ball", "icon");
// Create ball from the Xoml template and add it to game_scene
var xoml = new Xoml(app);
xoml.current_scene = game_scene; // Xoml system needs to know current scene so it knows where to look for dependent resources
var ball = xoml.parseResource(game_scene, ball_template);
ball.vx = 4;
ball.fill_style = "rgb(" + ((Math.random() * 255) << 0) + "," + ((Math.random() * 255) << 0) + "," + ((Math.random() * 255) << 0) + ")";
I took the opportunity to give Ludei’s CocoonJS a whirl and was quite pleased with the result. CocoonJS packages your app with its own optimised WebView which (on Android at least) is 10x faster in my tests than the default Android browser. Leapo plays at a good 60 fps on iOS and 30fps on Android running under CocoonJS. I’ve included CocoonJS with Booty5, you can enable CocoonJS export in the project properties.
2,536 total views, 1 views today