Author Topic: Co-ordinate Head Hurting  (Read 941 times)

FinalSin

  • Guest
Co-ordinate Head Hurting
« on: Sun, Jan 24, 2010 »
What does a co-ordinate mean in Flixel? It's driving me crazy!

If I drop the player at 100,100, that's a co-ordinate relative to the... screen? Yes? So how do I place something relative to the map. That is, if the map is 1000x1000 and the screen is 500x500, how do I place something in the bottom-right of the map? Setting it at (1000,1000) appears not to work, because that is counted as far off screen.

photonstorm

  • Administrator
  • Key Contributor
  • *****
  • Posts: 1502
  • Karma: +1/-0
    • View Profile
    • Photon Storm
Re: Co-ordinate Head Hurting
« Reply #1 on: Sun, Jan 24, 2010 »
To position an FlxSprite in the bottom right corner of a 1000x1000 map you would set its coordinates to be approx. 984x984 - this is assuming your tile map is using 16x16 sized tiles - the 984 gives the sprite a chance to not overlap with the bottom right-hand corner edge of your map. If you use a bigger/smaller tile size, then adjust accordingly.

You probably can't see the sprite because you haven't set the camera to follow it:

Code: [Select]
FlxG.follow(player);
Would do so, unless you've tried that and meant something else?
http://www.photonstorm.com



"Tell me and I will forget, show me and I might remember, involve me and I will understand" - Confucius