Commit Graph

159 Commits

Author SHA1 Message Date
Harsimran Singh Virk b7902bb141 Add support for dynamic 2D lights (#1881)
* This adds a **Light** object that can be added on the scene, with a customizable color and radius.
* Add the **Light Obstacle** behavior to the object that must acts as obstacle (walls, etc...) to the lights.
* You can customize the ambient color of the rest of the scene from almost white (useful to show light shadows) to entirely black (useful for horror/exploration games) or any color.
* Use effects on the "Lighting" layer like "Kawase Blur" to achieve soft shadows.
2020-08-17 17:48:26 +02:00
Florian Rival 5f54583ff5 Add TypeScript checks to gdjs.RuntimeScene, gdjs
Only show in developer changelog
2020-08-05 18:47:39 +02:00
Florian Rival c385aae845 Add support for "hot reloading" of previews (apply changes to preview without restarting) 2020-07-25 14:23:01 +01:00
Florian Rival 3a9f896f04 Add hot reloader (electron app only) 2020-07-25 14:23:00 +01:00
Florian Rival 661d329170 Upgrade game rendering to use Pixi.js 5.3.0, allowing games to run with WebGL 2 (#1824)
* This brings various upgrades and performance improvement to the internal rendering engine used by games, both in the editor and in exported games.
* This also paves the way for adding new objects like Bitmap Text, Mesh or dynamic lights in the future.
* Huge thanks to @Quarkstar for working on this task and making most of the necessary upgrades .
* Thanks @Bouh for helping fixing/upgrading the Shape Painter object and @Silver-Streak as well as testers from the forum

Don't show the rest in changelog:
* Add a test game with all effects that can be used, to quickly verify they are working.

Co-authored-by: Quarkstar <quarkstar9@gmail.com>
Co-authored-by: Aurélien Vivet <bouh.vivez@gmail.com>
2020-07-19 22:10:38 +01:00
Florian Rival b76df0247d Fix "Trigger Once" not working properly when used in a behavior
Don't show the rest in the changelog:

This was because the OnceTriggers were shared with the runtime scene. Now each behavior has its set of Once Triggers. This means that Once Triggers "survive" if the behavior is deactivated then activated again.

Added integration test for generated behavior

Fix #1843
2020-07-06 23:47:17 +02:00
Florian Rival 5f1a7bd72d Fix behaviors not working in an extension function when named differently than in the object
Fix #1796
2020-06-11 22:04:24 +01:00
Florian Rival ed7ddd2b67 Improve autocompletions for JavaScript code events and for the game engine 2020-05-17 19:30:58 +01:00
Garett Tok Ern Liang 348459481a Fix Left/Right Ctrl/Shift/Alt/Meta not recognised as separate keys (#1553) 2020-03-25 21:13:08 +01:00
Florian Rival 1193e1bbd0 Run Prettier autoformatting on some files 2020-03-19 23:17:38 +01:00
Florian Rival 6b6ec6f06f Upgrade another package-lock.json file to latest format 2020-02-25 20:46:03 +00:00
Florian Rival e95a336dd2 Add new GDJS callbacks: first scene loaded, pre/post events 2020-02-12 20:47:43 +00:00
Florian Rival b8ccf02f70 Refactor callbacks registration in GDJS 2020-02-11 23:33:30 +00:00
Arthur Pacaud 054e48227c Make object and behavior registering more explicit (#1379) 2020-01-17 22:49:24 +00:00
Florian Rival 64dbab1bce Fix layer center position after resolution update 2020-01-02 21:33:36 +00:00
Florian Rival 721b021b0a Fix memory leak and warning about texture not found.
Replaced the invalid texture for the PIXI image manager by a valid, hardcoded image. This:
* avoids a warning about not being able to load bunny.png (finally!)
* when creating a new Sprite, the invalid texture being used while the sprite is being set up, this was making PIXI adding a new event listener on the bunny.png texture. As the texture was not loaded, the event listener would never be removed, creating a leak.

Verified that the memory consumption is now stable on "Collisions with creation and deletion benchmark.gdg.json" benchmark game.
2019-12-08 23:16:16 +00:00
Florian Rival c4ba5f43fb Add test game for audio being played then immediately checked if stopped 2019-12-01 21:43:35 +00:00
Florian Rival 3fa3e57b24 Fix Sprite getWidth/getHeight returning old values just after changing animation or frame.
Fix verified in the new test game: the width/height reported is always synced with the animation.
2019-11-29 21:00:23 +00:00
Florian Rival a4a436b935 Add test games checking for proper working of points position after animation change 2019-11-29 21:00:23 +00:00
Florian Rival af21bc5aea Add command in GDJS to run TypeScript to type check the game engine 2019-11-28 23:01:43 +00:00
Florian Rival 9602caaccc Add checks for origin and center point position after flipping/rotating/scaling sprite 2019-10-26 15:10:38 +01:00
Florian Rival be2892b759 Fix hitboxes after flipX/flipY is called and add tests for sprite hitboxes/center/points 2019-10-26 14:15:14 +01:00
Florian Rival e1552f649c Check that custom hitboxes are properly working with flipped, non default center, sprites 2019-10-26 11:11:43 +01:00
Florian Rival 74bbd45265 Add test game to check the proper rotation/flip of a sprite with a non default center 2019-10-26 11:04:23 +01:00
Florian Rival 23987f63c7 Change sprites flipping to use the center point as center for flipping
As flipping can be considered as a way to "rotate" things, it makes sense to have it used as a center for flipping too.i
This is useful for objects that are moving and can be flipped according to if they are going left or right: they can now
be rotated and flipped "properly" (properly means that the center will stay at the same position when flipped/rotated)

This means that the center point won't move when the sprite is rotated or flipped.
The origin is still used as the point not moving in case of scaling. (this make sense because scaling is about the size, and origin about positioning)
This remove some calculations in the renderers, but add others in getDrawableX/Y and getCenterX/Y in case of flipping.
2019-10-26 11:04:23 +01:00
Florian Rival aa7a4a4ff3 Rename onOwnerRemovedFromScene to onDestroy and fix onCreated/onDestroy calls
* Rename onOwnerRemovedFromScene to onDestroy (because it can be now called when a scene is destroyed)
* Fix it being not called when a scene is destroyed (so behavior don't get a chance to clean up what they have created)
* Fix onCreated being called before the object is fully initialized (for custom behaviors or behaviors relying on an object type)
2019-07-28 17:43:50 +01:00
Florian Rival c03b8dd0db Add test for gdjs.RuntimeScene with object and behaviors 2019-07-28 17:43:50 +01:00
Florian Rival a7e0cd2cec Add gdjs.JsonManager to load json + added icons in ResourcePreview for all resources 2019-06-30 15:50:21 +01:00
Florian Rival bbb0738f5f Hide a property of a behavior in a test game 2019-06-16 17:08:55 +01:00
Florian Rival 181976e1b3 Add refactoring of properties actions/conditions/expressions when renaming property/behavior/extension 2019-06-16 17:08:55 +01:00
Florian Rival b1f7660ffa Add editor for properties of events based behaviors 2019-06-16 17:08:55 +01:00
Florian Rival 52489c3cc9 Add generation of action/conditions/expressions to use properties of events based behavior 2019-06-16 17:08:55 +01:00
Florian Rival 65a14eea7f Add tests for gdjs.VariablesContainer 2019-05-23 17:34:06 +01:00
Florian Rival 049483dbbd Fix support for calling behavior methods from other behavior methods 2019-05-20 23:36:13 +01:00
Florian Rival 89ac323c8e Add support for automatic refactoring when events function (including expressions) is renamed 2019-05-10 11:37:33 +01:00
Florian Rival 6332230c4c Add basic test game for EventsBasedBehavior 2019-05-06 23:32:37 +01:00
Wend1go 1c7d11a302 Add Tween behavior to animate object position/angle/properties (#980)
* Implementation based on Shifty.js
* Add examples
2019-04-03 23:34:11 +01:00
Florian Rival 3cf8a8ea65 Add callbacks for when a gdjs.RuntimeScene is paused/resumed 2019-03-14 22:56:19 +00:00
Florian Rival a4c372d945 Convert PointX/PointY argument to a string 2019-01-28 23:16:20 +00:00
Florian Rival 4af867ba3a Fix expression transforming structure variable to JSON 2019-01-23 17:47:15 +00:00
Florian Rival 1fb3231f98 Use constants to represents button in the game engine 2019-01-03 21:07:18 +00:00
Florian Rival 5a3d2cc2b9 Reduce iterations of polygon benchmark 2018-12-26 23:22:10 +01:00
Florian Rival 0f24410a2e Fix platform engine 1-pixel offset bug
* "Bug" is fixed by ignoring edges when doing collision tests for
the platform engine.
* Also add an option to round coordinates and ensure pixel-perfect
alignement of characters on platforms (on by default)
* Also add an optional parameter to ignore edges when
doing a collision test (or when separating objects)
2018-12-26 23:22:10 +01:00
Florian Rival f39af51fda Add benchmark for polygon collision test and add test runner for Firefox 2018-12-26 13:45:45 +01:00
Florian Rival 704eaacc7e Enable back all GDJS tests 2018-12-26 12:52:51 +01:00
Florian Rival cc92445d4c Update READMEs with more links/information/commands 2018-12-22 16:39:19 +01:00
Florian Rival 2e240643a2 Make access to variables 50% faster 2018-11-28 23:12:07 +00:00
Florian Rival 45d2844d8b Add FontResource and rework loading to ensure all fonts are properly loaded
* Add FontManager to the game engine, used to load and get access to loaded fonts.
* Use fontfaceobserver library to detect when a font is loaded.
* Add FontResource as a resource, like AudioResource.
* Update the TextEditor to use a selector for fonts.
* Refactor ResourceSelector floating label text
2018-11-12 23:45:01 +00:00
Florian Rival 566517320d Increase benchmarks timeout to avoid timeout on CI 2018-11-11 22:08:34 +00:00
Florian Rival 7a838fc8f9 Refactor GDJS benchmarks 2018-10-28 06:41:09 -07:00