Advertisement
Guest User

Untitled

a guest
May 21st, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1.  
  2.  
  3.  
  4.  
  5. var CharacterFactory = function(nameParam, imageParam, healthParam,
  6. counterAttackParam, attackPowerParam) {
  7.  
  8. var brandNewCharacter = {}
  9. brandNewCharacter.name = nameParam;
  10. brandNewCharacter.image = imageParam;
  11. brandNewCharacter.health = healthParam;
  12. brandNewCharacter.counterAttack = counterAttackParam;
  13. brandNewCharacter.attackPower = attackPowerParam;
  14. brandNewCharacter.AI = false;
  15.  
  16.  
  17. brandNewCharacter.imgClick = function (){
  18. // listen for when img is clicked
  19. }
  20. brandNewCharacter.moveImg = function (){
  21. // moves img
  22. }
  23. brandNewCharacter.loseHP = function(){
  24. // makes hp go down
  25. }
  26. brandNewCharacter.attack = function (){
  27. // does the math between attackPower and counter attack
  28. }
  29. brandNewCharacter.increaseAttackPower = function (){
  30.  
  31. }
  32. //our character is now ready to be delivered
  33. return brandNewCharacter
  34. }
  35.  
  36. var o = CharacterFactory('Obi', 'https://i.imgur.com/cHfYVxh.jpg', 50, 50, 50)
  37.  
  38.  
  39. var img =$(document.createElement('img'))
  40. img.attr('src', o.image);
  41. img.appendTo('#baseDiv');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement