game javascript droidscript

382 views
Skip to first unread message

Manuel Lopes

unread,
Oct 30, 2015, 6:42:24 PM10/30/15
to AndroidScript
have a good tutorial book for newbies to make games?(i see the exanple games but ask details in making first time) sorry ask this is my wish learn make games;thanks

sankarshan dudhate

unread,
Oct 31, 2015, 8:41:53 AM10/31/15
to AndroidScript
Hi Manuel,
There is no tutorial but there are samples. Just try to get what so and so code does. And most of the samples are also commented.
If you can tell us what sort of game you are planning, maybe we can help you better.
Remember, DS is still in beta but every now and then, new functionalities are being added. So, though there are not much tutorials, a good can come out anytime.
There is also a community wiki and it needs help from everyone including you. If you find that wiki is missing something, please consider adding it to wiki.

P.S. We have Steve German here. So, ask a question for some functionality and you'll surely get an answer.

Manuel Lopes

unread,
Oct 31, 2015, 8:45:38 AM10/31/15
to AndroidScript
Rpg. style ff6

Netpower8

unread,
Oct 31, 2015, 9:55:06 AM10/31/15
to AndroidScript
woooah. graphic intensive lots of movement... turn based if ever.

Manuel Lopes

unread,
Oct 31, 2015, 10:47:21 AM10/31/15
to AndroidScript
Yes i want turn base

Manuel Lopes

unread,
Oct 31, 2015, 10:48:10 AM10/31/15
to AndroidScript
Yes i want turn base

Dave Smart

unread,
Oct 31, 2015, 1:32:20 PM10/31/15
to AndroidScript
Hi Manuel,

If you want game tutorials and examples, then you might be best using the Phaser game framework.  You can download our Phaser example using the WiFi editor (on the demos) page and start there.  Then go to the Phaser web site and follow the tutorials there.  You will need a fairly modern phone to use Phaser though because it requires WebGL to perform well.

Regards
David

Manuel Lopes

unread,
Oct 31, 2015, 6:16:00 PM10/31/15
to AndroidScript
Is this for make games offline?can you send the links thanks

Chris

unread,
Oct 31, 2015, 7:56:39 PM10/31/15
to AndroidScript

Manuel Lopes

unread,
Nov 1, 2015, 6:21:03 AM11/1/15
to AndroidScript
Is for offline games ?if yes can show an sample to work on droidscript?thanks

Chris

unread,
Nov 1, 2015, 10:57:24 AM11/1/15
to AndroidScript
Um. Did you READ the phaser information? And Dave already answered that.

Manuel Lopes

unread,
Nov 1, 2015, 5:40:26 PM11/1/15
to AndroidScript
Is possible make offline games in droidscript with this module called enchant.js?if yes can you please post a sample to work with this?thanks

Manuel Lopes

unread,
Nov 2, 2015, 5:46:52 PM11/2/15
to AndroidScript
Anyone?

Chris

unread,
Nov 2, 2015, 6:05:04 PM11/2/15
to AndroidScript
Download the enchant.js - create a webview, code your game, load it into the webview. (DroidScript comes with samples for using webview).

Any of the enchant demos run in a webview.

Manuel Lopes

unread,
Nov 2, 2015, 6:19:08 PM11/2/15
to AndroidScript
Webview is server ?or can be in phone offline without any server?thanks im newbie

Manuel Lopes

unread,
Nov 2, 2015, 6:30:15 PM11/2/15
to AndroidScript
I download the wise9-enchant.js-v0.8.2-282-ga72c381.zip

Now what i have to extract or not?

Manuel Lopes

unread,
Nov 2, 2015, 6:36:19 PM11/2/15
to AndroidScript
Chris i have the sample example called hello bear now how to put work? Thanks

Chris

unread,
Nov 2, 2015, 7:03:56 PM11/2/15
to AndroidScript
Yes, webview can be used offline. Webview is technically the stock browser that comes with your device, minus all the controls. Think of it as an embedded browser.

Create a javascript app in DroidScript.


// Called when application is started.
function OnStart()
{
//Create a layout with objects vertically centered.
lay = app.CreateLayout( "linear", "VCenter,FillXY" );

//Create a web control.
web = app.CreateWebView( 0.8, 0.8 );
lay.AddChild( web );

web.LoadUrl( "file:///Page.html" );

app.AddLayout( lay );
}

Copy the example js and html files into your DroidScript app folder
/sdcard/DroidDcript/appName

Rename Page.html in my example to your html page example.

That should get you started.

Chris

unread,
Nov 2, 2015, 7:05:14 PM11/2/15
to AndroidScript
typo - /sdcard/DroidScript/AppName/
Message has been deleted

Manuel Lopes

unread,
Nov 2, 2015, 7:30:23 PM11/2/15
to AndroidScript
I put

// Called when application is started. 
function OnStart() 

        //Create a layout with objects vertically centered. 
        lay = app.CreateLayout( "linear", "VCenter,FillXY" );         

        //Create a web control. 
        web = app.CreateWebView( 0.8, 0.8 );   
        lay.AddChild( web ); 

        web.LoadUrl( "file:///sdcard/DroidScript/lk/index.html/" ); 
  
        app.AddLayout( lay ); 




Give error script error. file:///android_asset/webkit/android-weberror.png

Chris

unread,
Nov 3, 2015, 12:47:56 AM11/3/15
to AndroidScript
Take the last '/' off your path, and add 'IgnoreErrors' to the webview create.

Selo Soft

unread,
Nov 3, 2015, 4:03:56 AM11/3/15
to AndroidScript
Try this code ,all in apk or spk
    web = app.CreateWebView( 1, 1,"AllowZoom,Wide,AutoZoom" ,70); 
    web.SetOnProgress( web_OnProgess );
    web.SetBackGradient( "#461E62" , "#461E62" )
    web.SetPosition(0, 0.06);
    lay.AddChild( web ); 

    var isApk = (app.GetAppPath()=="/Assets"); 
     
    if( isApk ) folder="file:///android_asset/user/html/"; 
    else folder="file://"+app.GetAppPath()+"/html/"; 
    web.LoadUrl( folder + "index.html" ); 

//Show page load progress.
function web_OnProgess( progress )
{
app.Debug( "progress = " + progress );
if( progress==100 ) app.HideProgress();
}

Manuel Lopes

unread,
Nov 3, 2015, 9:51:35 AM11/3/15
to AndroidScript
I only remove the / and give error enchanted not defined

Manuel Lopes

unread,
Nov 3, 2015, 9:52:43 AM11/3/15
to AndroidScript
Work without error but show dark screen and not show anything

function OnStart() 

        //Create a layout with objects vertically centered. 
        lay = app.CreateLayout( "linear", "VCenter,FillXY" );         

        //Create a web control. 
        web = app.CreateWebView( 0.8, 0.8 );   

Manuel Lopes

unread,
Nov 3, 2015, 10:10:47 AM11/3/15
to AndroidScript
Enchanted is the .js into the build folder
index.html :
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="x-ua-compatible" content="IE=Edge">
<meta name="viewport" content="width=device-width, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<script type="text/javascript" src=" storage/emulated/0/DroidScript /build/enchant.js"></script>
<script type="text/javascript" src="main.js"></script>
<style type="text/css">
body {
margin: 0;
padding: 0;
}
</style>
</head>
<body>
</body>
</html>

Chris

unread,
Nov 3, 2015, 11:59:21 AM11/3/15
to AndroidScript
You need to move the build folder under your droisdcript app folder. Move EVERYTHING needed into this folder.

Then, use relative paths.

/build/enchant.js will not work, but build/enchant.js will -- IF it is in your app folder.

It is important, especially when using javascript libraries, that they are in your app folder, and the structure of the library stays intact.

Manuel Lopes

unread,
Nov 3, 2015, 4:04:26 PM11/3/15
to AndroidScript
Chris here my folder with all to see whats wrong ;thanks(not know if i can post link for upfile if not sorry is for help not spam)
http://upfile.mobi/1138469

Om Waghmode

unread,
May 15, 2017, 5:08:53 AM5/15/17
to DroidScript
I also want to learn
Reply all
Reply to author
Forward
0 new messages