Jump to content


Check out our Community Blogs

YoungPythoner

Member Since 25 Jun 2015
Offline Last Active Jul 15 2015 10:09 AM
-----

Topics I've Started

How To Make a Javascript Text Editor using DroidScript Part 2

03 July 2015 - 08:28 PM

Welcome guys!
We are in part 2 of my tutorial. Now we are writing variables and functions.
Functions is save and load!
Save:
We will save the text with WriteFile().
function save()
{
txt = txtbox.GetText()
filename = prompt("Write file name!")
app.WriteFile(filename, txt)
}
 
Load:
We will load a file with ReadFile().
function load()
{
filename = prompt("Write file name!")
settxt = app.ReadFile(filename)
txtbox.SetText(settxt)
}
 
And Run!
My tutorial is finished, hope you like it!

Javascript Is/If Collision Functions (My Functions)

03 July 2015 - 07:29 PM

Hi! I wrote a is/if collision functions. They're for games and anything. They are includes:

Up, down, left, right collisions.

Hope you like it!

function IfCollisionDown(x1, y1, w1, h1, x2, y2, w2, h2)
{
if (x1>x2-(w2/2)&&x1<x2+(w2/2)&&y1-(h1/2)<y2+(h2*1.5)&&y1>y2)
{
return true
}
else
{
return false
}
}

function IfCollisionRight(x1, y1, w1, h1, x2, y2, w2, h2)
{
if (y1<y2+(h2/2)&&y1>y2-(h2/2)&&x1-(w1/2)<x2+w2&&x1>x2)
{
return true
}
else
{
return false
}
}

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download