Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. function loadMap(){
  2. var newMap=document.getElementById('map').value
  3. var loopLimit = document.getElementById('map').value.length
  4. var wesIsDumb
  5. var x = 0
  6. var y = 0
  7. var test = []
  8. var theMap = [];
  9. clearMap(lastX,lastY)
  10. for(wesIsDumb=0;wesIsDumb<=loopLimit;wesIsDumb++){
  11. var sneetch = newMap.substring(wesIsDumb,wesIsDumb+1)
  12. if(sneetch == '\n'){
  13. y++
  14. x=0
  15. }
  16. else if(sneetch == ''){}
  17. else{
  18. var tile = reverseConvert(sneetch)
  19. var xLocation = 16*x+250;
  20. var yLocation = -16*y+640
  21.  
  22. createDiv(x, y)
  23. theMap.push(test)
  24. theMap[x][y] = sneetch
  25. document.getElementById('x'+x+'y'+y).innerHTML += "<img id='imgx"+x+'y'+y+"'src='./images/"+tile+".gif' style='position:absolute; bottom:"+yLocation+"px; left:"+xLocation+"px;' onmousedown='editTile("+x+'y'+y+")' onmouseover='editTileOver("+x+'y'+y+")' onmouseup='cursorUp()'>";
  26. lastX=x
  27. lastY=y
  28.  
  29. x++
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement