Skip to content

gameObject ( Core )

Arshia edited this page Dec 10, 2019 · 2 revisions

There Is Core And Power Of The Framework ! All Commands Are Easier Here ! You Can Create A gameObject With Giving Id Of The Element Then You Have All Commands !


Way To Use :

var player = new gameObject("player");
player.[function]();

All Functions Are Here :

moveX( x [ Count Of Pixels ] )

     Move The Game Object In x Pixels ( Horizontal ) .


moveY( y [ Count Of Pixels ] )

     Move The Game Object In y Pixels ( Vertical ) .


collisionTo( obj1 [ The HTML Object ] )

     Checks If There Is A Collision To Target Object Or Not .


getLocation( )

     Return A JSON Object Contains x And y Of The gameObject .


setImg( src [ The Image Source ] )

     Set The gameObject src .


remove( )

     Remove The Element .


x( )

     Returns The Object x .


y( )

     Returns The Object y .


setX( x [ The Target X ] )

     Set The gameObject X to x .


setY( y [ The Target Y ] )

     Set The gameObject Y to y .


setL( x [ The Target X ] , y [ The Target Y ] )

     Set The gameObject Y to y And X To x .


getDirection( obj1 [ The HTML Object ] )

     Acts LikeThat .


getDirectionS( obj1 [ The HTML Object ] )

     Acts Like That .


getDirectionG( obj1 [ The HTML Object ] )

     Acts Like That .


Some Useful Methods And Variables Are In This Example :

var a = new gameObject("player");
var b = new gameObject("enemy");
if(a.collisionTo(b.object)){
    print("Enemy Down !");
}

You Can Access To The Html Object Like That :

var a = new gameObject("test");
->a.object

You Can Find If Object Is gameObject Like That :

var a = new gameObject("test");
->a.type // If Returns "gameObject" , That's It ! Else Its An Html Object ! ( Or Something Else ... )