PositionToTileX function not found...

0 favourites
  • 5 posts
From the Asset Store
Use this game pack to create your own game, modify the existing game or simply take a look and see how it was made.
  • *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 :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Does it matter that you wrote positionToTile"X" twice in your code? Is the second one is supposed to be positionToTile"Y"?

  • Does it matter that you wrote positionToTile"X" twice in your code? Is the second one is supposed to be positionToTile"Y"?

    Yep definitely it should be positionToTile"Y" good spot

    "Not sure if that will fix your issue though" for:

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

  • 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?

  • I'm not of much help as I don't use the scripting though I think you will get better support if you post it in Scripting Section:

    https://www.construct.net/en/forum/construct-3/scripting-51

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)