Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Create
- _tileSize = 32;
- _tilew = _tileSize; // Tile Size Width
- _tileh = _tileSize; // Tile Size Height
- _tile_x = x div _tilew; // The horizontal tile position of the object
- _tile_y = y div _tileh; // The vertical tile position of the object
- // replace switch cases with below
- case 1: _moveX = -1 * _spd[1]; _tile_x -= 1; break;
- case 2: _moveX = 1 * _spd[1]; _tile_x += 1; break;
- case 3: _moveY = -1 * _spd[1]; _tile_y -= 1; break;
- case 4: _moveY = 1 * _spd[1]; _tile_y += 1; break;
- // _spd[1] = 1;
- // Add above alarm call "in alarm[1]"
- if (x = _tile_x * _tilew and y = _tile_y * _tileh) {
- if (_tile_x * _tilew > x + _tileSize * 2) {
- _moveX = 0; // set to 0 if reached 2 cells
- } else if (_tile_x * _tilew < x - _tileSize * 2) {
- _moveX = 0; // set to 0 if reached 2 cells
- }
- if (_tile_y * _tileh > y + _tileSize * 2) {
- _moveY = 0; // set to 0 if reached 2 cells
- } else if (_tile_y * _tileh < y - _tileSize * 2) {
- _moveY = 0; // set to 0 if reached 2 cells
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement