Miichiel's Forum Posts

  • 4 posts
  • There is no PositionToTileX in the Tilemap API in scripting. But you have all necessary to make your own.

    You have to look at the manual:

    https://www.construct.net/en/make-games/manuals/construct-3/scripting/scripting-reference/plugin-interfaces/tilemap

    Yeah I looked through the manual but could not find it in there.. yet i found this PositionToTileX function in some construct post...

    Absolutely do use the manual. Sometimes certain APIs are not (yet) available, which is a bit of a bummer, and you have to make your own functions for certain things.

    Thanks for the function setup. I already had something similar going on... But I thought I just did not had a main part of the scripting understood... So reason enough to ask what I was doing wrong...

    Thanks champs!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I posted this in How Do I, yet they told me to post it in scripting. I think i'm missing a import function? Because asking the TileMap to use function PositionToTileX is giving me a function not found: The tempTileMap is filled... I can use other functions such as GetTileAt()... Anyway the original post:

    So everywhere I read that you can use PositionToTileX function... yet this function is not accessible in my code... it says:

    Error: tempTileMap.PositionToTileX is not found
    

    tempPlayer is found, tempTileMap is found, if I use static numbers on the getTileAt it works...

    var tempPlayer = runtime.objects.Player.getFirstInstance();
    	var tempTileMap = runtime.objects.TilemapLevel.getFirstInstance();
    	var tempTileId = tempTileMap.getTileAt(tempTileMap.PositionToTileX(tempPlayer.x), tempTileMap.PositionToTileY(tempPlayer.y));
    

    So where do I get PositionToTileX? I'm using Construct 3 since yesterday :)

  • I changed it to

    	var tempTileId = tempTileMap.getTileAt(tempTileMap.PositionToTileX(tempPlayer.x), tempTileMap.PositionToTileY(tempPlayer.y));
    

    Yet still the error that PositionToTileX is not a function...

    Are you guys importing some modules that gains access to those functions?

  • *Sorry I also posted this in the wrong section (general discussion), can be removed over there.*

    So everywhere I read that you can use PositionToTileX function... yet this function is not accessible in my code... it says:

    Error: tempTileMap.PositionToTileX is not found
    

    tempPlayer is found, tempTileMap is found, if I use static numbers on the getTileAt it works...

    var tempPlayer = runtime.objects.Player.getFirstInstance();
    	var tempTileMap = runtime.objects.TilemapLevel.getFirstInstance();
    	var tempTileId = tempTileMap.getTileAt(tempTileMap.PositionToTileX(tempPlayer.x), tempTileMap.PositionToTileX(tempPlayer.y));
    

    So where do I get PositionToTileX? I'm using Construct 3 since yesterday :)

  • You do not have permission to view this post

  • You do not have permission to view this post

  • 4 posts