Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1.  
  2. // Create
  3. _tileSize = 32;
  4. _tilew = _tileSize; // Tile Size Width
  5. _tileh = _tileSize; // Tile Size Height
  6. _tile_x = x div _tilew; // The horizontal tile position of the object
  7. _tile_y = y div _tileh; // The vertical tile position of the object
  8.  
  9. // replace switch cases with below
  10. case 1: _moveX = -1 * _spd[1]; _tile_x -= 1; break;
  11. case 2: _moveX = 1 * _spd[1]; _tile_x += 1; break;
  12. case 3: _moveY = -1 * _spd[1]; _tile_y -= 1; break;
  13. case 4: _moveY = 1 * _spd[1]; _tile_y += 1; break;
  14.  
  15. // _spd[1] = 1;
  16.  
  17. // Add above alarm call "in alarm[1]"
  18. if (x = _tile_x * _tilew and y = _tile_y * _tileh) {
  19. if (_tile_x * _tilew > x + _tileSize * 2) {
  20. _moveX = 0; // set to 0 if reached 2 cells
  21. } else if (_tile_x * _tilew < x - _tileSize * 2) {
  22. _moveX = 0; // set to 0 if reached 2 cells
  23. }
  24. if (_tile_y * _tileh > y + _tileSize * 2) {
  25. _moveY = 0; // set to 0 if reached 2 cells
  26. } else if (_tile_y * _tileh < y - _tileSize * 2) {
  27. _moveY = 0; // set to 0 if reached 2 cells
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement