• Question
  • getting undefined error in my tower defense game

pluto
not even close
i didn't implement:
moneys
abilities
winning
losing
more than 1 level
loadout selection

so theres plenty more for u to do

-wyi this is an over simplification btw

pluto
so basically what i did:

  • replaced all the redundant switch statements with for loops so you don't have to manually plug in every hotbar slot, type of tower, and enemy
    // to remind you how a for loop works:
    for(var i = 0; i < array.length; i++){
    // create variable i and iterate from zero to the length of the array
    console.log(array[i]);
    // print the ith object in the array, since i goes from zero to the length of the array everything in the array is printed
    }
  • added different types of enemies
  • added wave setup variable(creates enemies at specified locations after specified delays with optional messages)
  • added pivot setup variable(creates a bunch of points that will turn enemies when they touch them, causing the enemies to follow a path).
    You can make these pivots visible by changing the variable at the top of the code.
  • fixed enemy+tower size, stats, movement, and shooting.
    enemies/towers/bullets have all the basic attributes, like health and speed, as well as a 'data' attribute which is all of the stats from their type.
    ex: enemy.health gives current health, enemy.data.health gives the max health of all enemies of that type.
  • got rid of all the setIntervals and replaced them with frame-based timing, general advice unless ur making a rythm game or animation or somethin don't use setInterval.

ackvonhuelio Your stuff is confusing but I'll figure it out well enough with time.

[unknown] i thought i had a basic knowledge of arrays, but i don't lol

  • -wyi replied to this.

    ackvonhuelio
    What do the variables "i" and "q" on lines 325 - 347 do? I'm kinda just trying to use to code as a way to make an A.I. that shoots other A.I.s of different factions.

    • -wyi replied to this.

      [unknown]
      i and q are parts of the for loops
      see my above comment for reminder on how for loops work

      lines 379 and 381 are leftover from plutos original code, its doing absolutely nothing but i never bothered to delete the variables

      • -wyi replied to this.

        Chat