| 276 | } |
| 277 | |
| 278 | function init(){ |
| 279 | w = window.innerWidth - 20; |
| 280 | h = window.innerHeight - 70; |
| 281 | c.width = w; |
| 282 | c.height = h; |
| 283 | bg.width = w; |
| 284 | bg.height = h; |
| 285 | player.x = w/2-(35/100*w); |
| 286 | player.y = h/2+(6.5/100*h); |
| 287 | player.width = 7/100*w; |
| 288 | player.height = 15/100*h; |
| 289 | balloon.x = Math.floor(Math.random()*((w/2+20/100*w)-(w/2-(20/100*w)))+(w/2-(20/100))); |
| 290 | balloon.y = Math.floor(Math.random()*((4*h)-h)+h); |
| 291 | balloon.width = 10/100*w; |
| 292 | balloon.height = 15/100*h; |
| 293 | balloon2.x = Math.floor(Math.random()*((w/2+20/100*w)-(w/2-(20/100*w)))+(w/2-(20/100))); |
| 294 | balloon2.y = Math.floor(Math.random()*((3*h)-h)+h); |
| 295 | balloon2.width = 10/100*w; |
| 296 | balloon2.height = 15/100*h; |
| 297 | balloon3.x = Math.floor(Math.random()*((w/2+20/100*w)-(w/2-(20/100*w)))+(w/2-(20/100))); |
| 298 | balloon3.y = Math.floor(Math.random()*((2*h)-h)+h); |
| 299 | balloon3.width = 10/100*w; |
| 300 | balloon3.height = 15/100*h; |
| 301 | bullet.x = player.x+5; |
| 302 | bullet.y = player.y+5/100*h; |
| 303 | bullet.width = 2/100*w; |
| 304 | bullet.height = 2/100*h; |
| 305 | wind.x = Math.floor(Math.random()*((5*w)-w)+w); |
| 306 | wind.y = h/2; |
| 307 | wind.width = 10/100*w; |
| 308 | wind.height = 10/100*h; |
| 309 | } |