javascript - Code with a ship which shooting wrong -


i posted before question not right. why shoots not following ship shooting????? stays @ 1 position if move ship away.......i added guess.....out of ideas..any appreciated.

      function shoot(){        context.fillstyle = "black";         context.fillrect(x2, y2--, 5,10);         context.fillstyle = "red";         context.fillrect(x2, y2, 5,10);         if (y2>=0) {                 timer=settimeout(shoot(), 1);             }            else {                 context.fillstyle="black";                 context.fillrect(x2, y2, 5,10);                 y2=320;                 context.fillrect(x+23, y2, 5,10);             }        } 

heres fiddle solution http://jsfiddle.net/yabh4/
changed shoot function use player.x. , commented below 2 lines

  //   context.fillrect(x2, y2, 5,10);             y2=320;   //   context.fillrect(x+23, y2, 5,10); 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -