Works OK for me, even on Galaxy S3 default web browser (the only issue being touch input/mousepress). This is so great that it would make me to start playing with JS. Will be watching youkikito wrote:You can see some usage examples on the examples folder. Feel free to comment, I'm still learning the language.
[javascript]Luv.js
Re: [javascript]Luv.js
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: [javascript]Luv.js
Yes, there are several projects that translate Box2d to javascript. The question was (or at least that's how I read it) whether there would be one "included by default" into Luv.js.Jasoco wrote:Doesn't a JavaScript version of Box2D already exist anyway? It's even included in another JavaScript/HTML5 game creating API system.
I've been able to try it on an Ipad and it works reasonably well, too! There's a branch where've done a touch interface for mobile devices, will let you guys know when it's done.miko wrote:Works OK for me, even on Galaxy S3 default web browser (the only issue being touch input/mousepress). This is so great that it would make me to start playing with JS. Will be watching you
EDIT: I have now added support for touch events ... and tweening! Touch events are not Internet Explorer-compatible, I'm afraid.
The demo, with some tweening, is here (you will need an ipad or touch-compatible dispositive to see anything, otherwise it will be a black screen):
http://kikito.github.io/luv.js/examples/fingers.html
The touch interface is in luv.touch.
The timing/tweening interface is inside luv.timer, in the form of luv.timer.after, luv.timer.every & luv.timer.tween. Each of them has a specialized submodule inside luv.timer. The tweening one is specially interesting.
When I write def I mean function.
Re: [javascript]Luv.js
Have you decided whether or not to insert sound?
If so, here I leave the source code of an html5 player I created and can serve as a basis for using the HTML5 Audio API
https://github.com/FireZenk/html5player
If so, here I leave the source code of an html5 player I created and can serve as a basis for using the HTML5 Audio API
https://github.com/FireZenk/html5player
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: [javascript]Luv.js
Hi there,
Indeed, Luv.js has sound. Simple example here: http://kikito.github.io/luv.js/examples/#ding and API docs here: http://kikito.github.io/luv.js/docs/audio.html
Development on that lib is on hold at the moment since I needed to find a good way to deal with collisions. I'm doing bump 2.0 in Lua, and then will export it to Luv.
Regards!
Indeed, Luv.js has sound. Simple example here: http://kikito.github.io/luv.js/examples/#ding and API docs here: http://kikito.github.io/luv.js/docs/audio.html
Development on that lib is on hold at the moment since I needed to find a good way to deal with collisions. I'm doing bump 2.0 in Lua, and then will export it to Luv.
Regards!
When I write def I mean function.
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Re: [javascript]Luv.js
That library makes me want to learn JS.
Question: from your own insight, can you say if it is possible to write a kind of wrapper for Löve games, written in Lua ?
I don't know if it will just take to bind the API functions/methods in JS to Löve Lua API...But it would be cool to have this possibility, hopefully when this project will be more complete.
Question: from your own insight, can you say if it is possible to write a kind of wrapper for Löve games, written in Lua ?
I don't know if it will just take to bind the API functions/methods in JS to Löve Lua API...But it would be cool to have this possibility, hopefully when this project will be more complete.
Re: [javascript]Luv.js
Thanks Kikito
I've been playing around with Luv.js and the truth is that it preserves the essence of Love2D, thanks for that
@Roland_Yonaba: I think we don't need take this way...
Javascript is fairly easy to learn and the syntax is not so different from Lua.
There is also a plugin for Chrome that runs .love files in the browser (is the simplest way to execute love2d in the browser for now)
I've been playing around with Luv.js and the truth is that it preserves the essence of Love2D, thanks for that
@Roland_Yonaba: I think we don't need take this way...
Javascript is fairly easy to learn and the syntax is not so different from Lua.
There is also a plugin for Chrome that runs .love files in the browser (is the simplest way to execute love2d in the browser for now)
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: [javascript]Luv.js
It is possible to write most of it. For certain definitions of possible.Roland_Yonaba wrote:That library makes me want to learn JS.
Question: from your own insight, can you say if it is possible to write a kind of wrapper for Löve games, written in Lua ?
- Browsers certainly have the graphical prowness, at least modern ones. They even have shaders.
- Audio support is still shaky. Chrome is able to do everything LÖVE does and then some more. The rest can do very basic stuff (play, pause, rewind). Handling multiple simultaneous sources is a pain (just like in LÖVE, yay!). And the available formats depend on the browser. The safest bet is providing at least mp3 and ogg (or only ogg, if you don't care about IE).
- Lua is already working on the browser.
- It is possible to download and unzip a file to memory in js.
- It would always lag behind canonical LÖVE, since it would be a reimplementation.
- Expect platform flakiness, especially regarding execution speed (mobile browsers!)
- Sound issues will happen
- I also have concerns about speed.
- While I have tried to mimic the spirit of LÖVE in Luv, it is definitively not a 1-to-1 relation. Some of the design decisions I made are different from the ones the LÖVE team took (and that's alright).
You are too kind . Beware that I'm going to move all the drawing operations to canvas and have a luv.canvas object created at the beginning. luv.graphics will still be used to create graphics-related stuff. That will be different from what happens now (everything is done in luv.graphics) but I think it will be a cleaner solution. It will also make it easier to implement a webgl-based canvas in the future.FireZenk wrote:I've been playing around with Luv.js and the truth is that it preserves the essence of Love2D, thanks for that
When I write def I mean function.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: [javascript]Luv.js
Just an update:
Yesterday I made a significant change in how the main canvas is managed in Luv.js.
Before it was done like in LÖVE: you had luv.graphics.line(...), luv.graphics.arc(...), etc drawing on the screen by default, unless you called luv.graphics.setCanvas(otherCanvas).
Now I have decided to have the default canvas in a fixed position: luv.canvas. So you can draw lines on the screen with luv.canvas.line(...), luv.canvas.arc(...) etc. Since the draw methods are now on the Canvas class, to draw in otherCanvas you just do otherCanvas.line(...). When you are finished drawing in an off-screen canvas, you can do luv.canvas.draw(otherCanvas, x, y) to show it on the screen. You can also draw an off-screen canvas to another offscreen canvas with otherCanvas.draw(yetAnotherCanvas, x, y)
This is a change I wanted to get out of my chest since a long time ago. I like this api more than LÖVE's (at least in <=0.8, I don't know what these guys are doing for 0.9). There is less tension in the code; luv.graphics is only in charge of building graphical stuff (Images, Animations, other Canvases) while the drawing itself happens on the Canvas class.
Now, to the collision
Yesterday I made a significant change in how the main canvas is managed in Luv.js.
Before it was done like in LÖVE: you had luv.graphics.line(...), luv.graphics.arc(...), etc drawing on the screen by default, unless you called luv.graphics.setCanvas(otherCanvas).
Now I have decided to have the default canvas in a fixed position: luv.canvas. So you can draw lines on the screen with luv.canvas.line(...), luv.canvas.arc(...) etc. Since the draw methods are now on the Canvas class, to draw in otherCanvas you just do otherCanvas.line(...). When you are finished drawing in an off-screen canvas, you can do luv.canvas.draw(otherCanvas, x, y) to show it on the screen. You can also draw an off-screen canvas to another offscreen canvas with otherCanvas.draw(yetAnotherCanvas, x, y)
This is a change I wanted to get out of my chest since a long time ago. I like this api more than LÖVE's (at least in <=0.8, I don't know what these guys are doing for 0.9). There is less tension in the code; luv.graphics is only in charge of building graphical stuff (Images, Animations, other Canvases) while the drawing itself happens on the Canvas class.
Now, to the collision
When I write def I mean function.
Re: [javascript]Luv.js
Great work!
But I have a question: can you set the color for an image? I can't seem to be able to do that.
But I have a question: can you set the color for an image? I can't seem to be able to do that.
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
personal page and a raycaster
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: [javascript]Luv.js
Hi, image tinting is on my list. The recent change I made to the canvas system was in order to facilitate this change (which in turn would be useful for particle systems as well as for image fonts). But it's still not done. For now the best you can do is drawing semi-transparent colored rectangles over the images (which sucks, I know).
When I write def I mean function.
Who is online
Users browsing this forum: No registered users and 1 guest