Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. var rows is an array of arrays, representing the table that is returned from a query to the postgres database.
  2. rows[x] will return a row in the table.
  3. rows[x][y] will return a column of a row in the table (ex. title or mana or attack, etc.)
  4. the way i have set up my code is that the columns of a row are in this order:
  5. 0 - title
  6. 1 - mana
  7. 2 - attack
  8. 3 - health
  9. 4 - ability (i didnt really use this but i am lazy and dont want to change all my indexes)
  10. 5 - maintext
  11. 6 - flavortext
  12. 7 - type
  13. 8 - rarity
  14. 9 - class
  15. 10 - views (not used, didnt know if we wanted to actually implement this)
  16. 11 - imagepath
  17.  
  18. i dont think i missed anything, but if you want to add data to display, add it to the END of the array. unless you want to change the drawing code a bit, don't change this order.
  19.  
  20. at the beginning, all the paths (src) to the card images (except the user uploaded pic) are hard coded. all these paths are then stored an array called
  21. paths
  22. they are stored IN A VERY SPECIFIC ORDER. minion card templates are from index 6-15, spell card templates are from index 16-25, and they are ordered by class in this order:
  23. druid, hunter, mage, neutral, paladin, priest, rogue, shaman, warlock, warrior
  24.  
  25. the script will create a canvas (area where you draw all the cards) that you can set the size of by editing the variables
  26. canvas.width = 1200;
  27. canvas.height = 1000;
  28. this is what they are set to right now, you will most likely have to increase the height. i allocated 400 pixels per card horizontally, and 500 pixels per card vertically. you can change these values by editing
  29. var hpxPerCard = 400;
  30. var vpxPerCard = 500;
  31. the position of all images are based off of these values.
  32.  
  33. walkthrough of script:
  34. get user image through imagepath (index 11 of the row), resize to 214x214, and draw it. this dimension works pretty well for both the minion and spell cards.
  35. find the appropriate card template (what class, minion or spell) and draw it.
  36. draw all the other shit like the mana, health, text, etc.
  37. the flavor text is displayed right below the card in italics.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement