Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

NON - Free 2D Lua and MoonScript Game Engine


YourBestNightmare
 Share

Recommended Posts

  • Replies 146
  • Created
  • Last Reply

Top Posters In This Topic

New update

Added back TypeScript and CoffeeScript support. Working hard on LUA integration, but loading natives in cross-platform manner is a bit hard. You can view full commit here: [https://github.com/codeindie/non](https://github.com/codeindie/non)

Also some new screenies:

Logcat output:

![](http://eclipseorigins.com/community/filehost/c479c5d6be1cd2789d321cabbd484db0.png)

Updated light engine example running on Android :3

![](http://eclipseorigins.com/community/filehost/97529e070d8110b1d2fc38ce5c7ba8bb.png)
Link to comment
Share on other sites

@Sacra entire source code of that Android example (43 lines). Also located here in examples folder on GItHub: [https://github.com/codeindie/non/blob/master/examples/javascript/main.js](https://github.com/codeindie/non/blob/master/examples/javascript/main.js)

```
var map, pressed, client, server, msg, light, circle;

non.ready = function() {
map = tiled.newMap("data/map.tmx");
audio.play(audio.newMusic("data/music.ogg"));

physics.setGravity(0,10).init();
physics.newShape(map.data.getLayers().get("Collisions").getObjects());
physics.newShape(math.newRectangle(32,10,20,20));
physics.newShape(math.newRectangle(100,10,20,20));
physics.newShape(math.newRectangle(120,80,20,20));
physics.newShape(math.newRectangle(8,150,20,20), "static");
physics.newShape(math.newRectangle(240,300,200,20), "static");

circle = physics.newShape(math.newCircle(32,64,20), "dynamic", 0.5, 0.4, 0.6);
lights.setShadows(true).setCulling(false).init(physics);
light = lights.newPointLight(100, graphics.newColor("red"), 500, input.touch.getX(), input.touch.getY());
};

non.resize = function() {
graphics.resize().update();
}

non.update = function() {
physics.update();
lights.update();

light.setPosition(input.touch.getX(), input.touch.getY());
circle.setTransform(input.touch.getX(), input.touch.getY(), 0);
};

non.draw = function() {
graphics.begin();
map.draw(graphics);
lights.draw(graphics);
physics.draw(graphics);

graphics.draw("Author: YourBestNightmare", 10, 10, graphics.newColor("yellow"));
graphics.draw("Engine: non (no nonsense) framework", 10, 34, graphics.newColor("white"));
graphics.draw("Mouse pos: [" + input.touch.getX() + "," + input.touch.getY() + "] Light pos: [" + light.getPosition().x + "," + light.getPosition().y + "]", 10, 58, graphics.newColor("white"));
graphics.draw("FPS: " + non.getFPS(), 10, 82, graphics.newColor("white"));
graphics.end();
};

```
Link to comment
Share on other sites

So I was working on NON a lot in past few days. I decided that I should add some more features to configuration file for non. So now, but can configure dependencies, plugins, signing of android apks and a lot more.

Here is example of new non.cfg:
```
{
"name": "non",
"version": "1.0.0",
"main": "main.js",
"plugins": [ "Graphics", "Audio" ],

"core": {
"dependencies": {
"compile": ['commons-io:commons-io:2.4']
}
},

"desktop": {
"configuration": {
"resolution": [ 800, 600 ],
"fullscreen": true
}
},

"android": {
"configuration": {
"signing": [ "./keystore", "123456", "non", "123456" ]
}
}
}
```
Link to comment
Share on other sites

When will this be usable?

It might be right now, but I mean, what's the point on having such great features when no one uses this [dunno for what reason]

Particles are ok to add, but right now would suck.

Maybe try adding something wich will motivate people using NON.
Link to comment
Share on other sites

> When will this be usable?
>
> It might be right now, but I mean, what's the point on having such great features when no one uses this [dunno for what reason]
>
>  
>
> Particles are ok to add, but right now would suck.
>
>  
>
> Maybe try adding something wich will motivate people using NON.

If you want to use it you are free to. It's a framework not an engine. There may be better frameworks out there. There maybe worse. This defiantly isn't a well known one and not many people here have knowledge in Java. If you want to use it then feel free to create a game or an engine out of this because this should be pretty stable.
Link to comment
Share on other sites

> If you want to use it you are free to. It's a framework not an engine. There may be better frameworks out there. There maybe worse. This defiantly isn't a well known one and not many people here have knowledge in Java. If you want to use it then feel free to create a game or an engine out of this because this should be pretty stable.

It is not actually framework. It is something in between, because frameworks are mostly libraries what you will use when making games etc. NON also includes compiler, so it is more engine than framework. And you do not need knowledge at java at all becouse in NON you use JavaScript or Lua to make games, NON only compiles these scripts to Java.
Link to comment
Share on other sites

And @Lumiere noone is using this because it is still in development stage and so I do not began to share it anywhere only in this community.

New update

Finally got some time and stress-tested Lua support for Android. Here is official screenie of Hello World application written in Lua running on Android 4.4.2 with x86 processor. 60 FPS of course. Also, link to GitHub commit for more info about update: [https://github.com/codeindie/non/commit/a242d3f2d6d4c8825ee2249ab67ba8d6f7415bbf](https://github.com/codeindie/non/commit/a242d3f2d6d4c8825ee2249ab67ba8d6f7415bbf)

![](http://eclipseorigins.com/community/filehost/38dfd6822172093f227c4691dd8c2ec6.png)

And here is source code of above example:

```
non.draw = function()
-- Insert rendering logic here
graphics:begin()
graphics:draw("Hello World!", 15, 15)
graphics:display()
end
```
Link to comment
Share on other sites

New update

In this update:

- I added non.jar. It is non launcher. Now, to use non, only 3 files are

required: non, non.bat and non.jar.

- Overhauled JavaScript implementation (method of invoking functions

from code).

- Moved default non plugins to non.plugins.internal package.

- Renamed "html" project to "web"

- Changed "gen" task

Also, here is some small tutorial on how easy is to make plugin for NON:

1: Create new folder "plugins" in place where your "non.jar" resides

2: In "plugins" folder create new file called Foo.java

3: In this file, put this:

```
package non.plugins;
import non.Non;

public class Foo extends Plugin {
public void Bar() {
Non.log("Foo", "Bar!");
}
}

```
4:

In javascript, you can use this plugin like this:

```
non.ready = function() {
foo.bar();
}

```
And in lua:

```
non.ready = function()
foo:bar()
end

```
Link to comment
Share on other sites

MERRY CHRISTMAS

![](https://pbs.twimg.com/media/B5pDngGCIAAYyo5.png)

```
non.ready = function() {
// Insert initialization logic here
img = graphics.newImage("bg.png");
img.setScale(math.newVector(non.getWidth() / img.getWidth(),non.getHeight() / img.getHeight()));
};

non.draw = function() {
// Insert rendering logic here
graphics.begin();
graphics.draw(img, 0, 0);
graphics.draw("MERRY CHRISTMAS!", 15, 15);
graphics.display();
};

```
Link to comment
Share on other sites

New update

- Added accelerometer support for mobile platforms. (input.accelerometer)

- Added "input.vibrate(duration)" method for android devices.

- Added "show()" and "hide()" methods for "input.keyboard" what can show and hide onscreen keyboard on mobile devices.

- Added "non.file(path)" method for easy loading and manipulating files.

- Restructured source code and reduced NON command-line launcher to one class (launcher.class in src folder).
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share


×
×
  • Create New...