Crear un mapper e inicializarlo

Post Reply
User avatar
efraimsangil
Site Admin
Posts: 209
Joined: Mon Sep 27, 2021 10:42 am
Has thanked: 152 times
Been thanked: 88 times

Crear un mapper e inicializarlo

Post by efraimsangil »

Code: Select all

class Mapper implements GL_Program
{
	properties:
		mapper = null;
		
	virtual Start()
	{
		_mapper = NewMapper("map");
		mapper = _mapper;
		
		_ts = _mapper.AddTileSet("tiles.tga", 16, 16);
		
		_layer = _mapper.AddLayer(100, 100);
		
		for(j=0; j<100; j++)
		{
			for (i=0; i<100; i++)
			{
				_layer.Set(i, j, _ts, Rand(0,31));
			}
		}
		
		_pad = NewPad("pad");
		_pad.SetPreset("CURSORS");
		
		_controller = NewController("contr");
		_controller.SetPad(_pad);
		_controller.SetUpdateCallback(this, "OnController");
	}
	
	function OnController(_controller)
	{
		mapper.SetOffset(_controller.GetX(), _controller.GetY());
	}
}
El archivo "tiles.tga" sería este:
Image
Requiere build >= 20440
Post Reply