Graphics

Reply

Tile Map Sample using SampleLib

Here is a basic tiled map example that uses a single draw call with one vertex buffer to draw the scene.

 

Hopefully it will prove useful for some of you.

 

www.rockingpocketgames.com/Vita/TiledMapSample.zip

www.RockingPocketGames.com
Please use plain text.

Re: Tile Map Sample using SampleLib

I've updated the archive today and cleaned up the code a bit.

www.RockingPocketGames.com
Please use plain text.

Re: Tile Map Sample using SampleLib

Thanks. Good demo/example.

Please use plain text.

Level 1

Level 1
asdfADRIAN
Posts: 36
Registered: ‎15-05-2012
Message 4 of 6 (308 Views)

Re: Tile Map Sample using SampleLib

Would anyone know how to use this without xml/tmx binary files? Anyway to use .png file format without binary and even more so, compress it via zlib? 

 

Thatd be great asI dont want to be limited to tiles and the editor. Currently trying to load maps of 6,000 pixels wide in segments of about 700 pixels wide and Im hoping to adapt this to such a system.

 

Could anyone help me out?  Similar to the 2dactiongame demo but thatll load the log background layer 5 times in width. 

Come join The Freenode IRC at Channel #pss-dev!

I am merely a graphics designer who wants to program, go figure.

Please use plain text.

Re: Tile Map Sample using SampleLib

I'm having problem syncing the sprite with the tilemap. in this code:

 

public override bool Frame()
        {
            
            CameraPositionX = ( (int)player2.PositionX - screenWidth/2) ;
            CameraPositionY = ( (int)player2.PositionY - screenHeight/2 ) ;
                                
            updatePadTileCam();
                        
            return true;
        }
public void updatePadTileCam()
        {
            var pad = InputManager.InputGamePad;
            
            if ((pad.Scan & InputGamePadState.Up) != 0)
                player2.PositionY -= 5;
        
            if ((pad.Scan & InputGamePadState.Down) != 0)
                player2.PositionY += 5;

            if ((pad.Scan & InputGamePadState.Left) != 0)
                player2.PositionX -= 5;
            
            if ((pad.Scan & InputGamePadState.Right) != 0)
                player2.PositionX += 5;
            
        }

 

I want the player2(a SampleSprite) to be centered to the camera when I move the player2's position but it seems like the player is going faster than the camera. Need help thanks.


Join the IRC Chatroom at:

Server: freenode
room: #psm-dev
Veharlek
Blog
Dan
Please use plain text.

Re: Tile Map Sample using SampleLib

[ Edited ]

Here is what I use for sprites:

 

public class Sprite

{

  public Vector2 Position;

  public float Rotation;

  public int Texture;

 

  public void SetTexture (int tex)

  {   

  Texture = tex;

  }

 

 public void Draw ()

  {

   Vector2 p;

  

  p.X = Position.X - Game.CameraPosition.X;

  p.Y = Position.Y - Game.CameraPosition.Y;

 

  GameTexture tex = Game.Textures[(int)Texture];

  tex.drawAtPointScale (p.X, p.Y, 1.0f, Rotation+180);

}

 

}

 

www.RockingPocketGames.com
Please use plain text.
This widget could not be displayed.
Announcements

Welcome to the PlayStation Mobile Developer Forums


This is a community for the discussion of technical topics with other developers and SCE engineers. Posting ideas/requests are also appreciated. Join the discussion!

PlayStation®Mobile開発者フォーラムでは世界中の開発者の皆様と一緒に、議論や情報交換が可能です。SCEも議論に参加し、皆様の開発をサポートします。アイデアやリクエストも大歓迎です。ぜひご参加ください。

PSM Developer Registration (for free) on PSM DevPortal is required to post on the forum.
Please sign out then sign in again to the forum and PSM DevPortal after you have completed the registration.

フォーラムへ投稿をするにはPSM DevPortalへの登録(無料)が必要です。
登録後はフォーラムと PSM DevPortalを一度ログアウトし、再度ログインしてください。






Recent News