diff --git a/Space Gun/bigImage.jpeg b/Space Gun/bigImage.jpeg
new file mode 100644
index 00000000..bb80ec03
Binary files /dev/null and b/Space Gun/bigImage.jpeg differ
diff --git a/Space Gun/css/style.css b/Space Gun/css/style.css
new file mode 100644
index 00000000..19e7060b
--- /dev/null
+++ b/Space Gun/css/style.css
@@ -0,0 +1,10 @@
+*{
+ margin:0;
+ padding:0;
+}
+
+body,html {height:100%; width:100%;overflow:hidden;}
+
+#_canvas {
+ position:absolute;
+}
diff --git a/Space Gun/index.html b/Space Gun/index.html
new file mode 100644
index 00000000..09e81868
--- /dev/null
+++ b/Space Gun/index.html
@@ -0,0 +1,27 @@
+
+
+
+
+ Space-Gum
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Space Gun/js/bg.js b/Space Gun/js/bg.js
new file mode 100644
index 00000000..c005688c
--- /dev/null
+++ b/Space Gun/js/bg.js
@@ -0,0 +1,83 @@
+class Star {
+ constructor(x ,y, r, n, inset, ninth){
+ this.x=x;
+ this.y=y;
+ this.r=r *_zoom;
+ this.n=n;
+ this.inset=inset;
+
+ this.NINTH = ninth;
+ }
+ draw (){
+ ctx.save();
+ ctx.fillStyle = "white";
+ ctx.shadowColor = "white";
+ ctx.shadowBlur = 5;
+ ctx.beginPath();
+ ctx.translate(this.x,this.y);
+ ctx.moveTo(0,0-this.r);
+ for (var i=0;iplate[index]=el+","+op+")");
+ return plate[i];
+ }
+
+ createCollisionFigures(){
+ var result = [];
+ var i = Math.floor(Math.random()*40);
+ for (var j=0;j1) {
+ this.flag = 1;
+ }
+ }
+}
diff --git a/Space Gun/js/game.js b/Space Gun/js/game.js
new file mode 100644
index 00000000..2e78bc99
--- /dev/null
+++ b/Space Gun/js/game.js
@@ -0,0 +1,345 @@
+
+_STARS_NUM = 600;
+_METEORS_NUM = 15;
+const _stars = stars(_STARS_NUM);
+m = meteors(_METEORS_NUM);
+const _spaceship = new Spaceship(15,0);
+const _steering = Math.PI/100;
+_shots = [];
+_electrics = [];
+colls = [];
+
+hits_counter = 0;
+shots_counter = 0;
+
+document.addEventListener('keydown', (event)=>{
+ onkeydown(event);
+ });
+map = {};
+shot_timeout = 0;
+help_timeout = 0;
+firemode_timeout = 0;
+speed_timeout = 0;
+fuel_refill_timeout = 0;
+upgrade_timeout = 0;
+upgrade_request = 0;
+
+
+document.addEventListener('touchstart', function(e) {
+ var pressLoc = {'x':e.touches[0].pageX, 'y':e.touches[0].pageY};
+ var pressed = Interface_Buttons.pressedLoop(pressLoc);
+ if (pressed == 1) return;
+ var theta = Math.atan(((e.touches[0].pageY-H/2) / (e.touches[0].pageX-W/2)))/Math.PI+1;
+ if (e.touches[0].pageX>W/2 && e.touches[0].pageY > H/2)
+ _spaceship.d = theta -1;
+ else if (e.touches[0].pageX>W/2 && e.touches[0].pageY < H/2)
+ _spaceship.d = theta + 1;
+ else _spaceship.d = theta;
+
+}, false);
+
+function shoot_handler(){
+ if (_spaceship.life_state == 1) {
+ _spaceship.reset(_spaceship.mobile_flag);
+ hide_selected_btns();
+ Spaceship_Fuel_Capacity = 100;
+ Spaceship_Acc_Factor = 2;
+ return;
+ }
+ let ex= W/2 + 900 * Math.cos(_spaceship.d *Math.PI);
+ let ey= H/2 + 900 * Math.sin(_spaceship.d *Math.PI);
+ if (_spaceship.fire_mode == 0 && _spaceship.shotI_bank>0) {
+ _shots.push(new ShotI(ex,ey,_spaceship.d));
+ shots_counter += 1;
+ for (var i=1;i<=_spaceship.spread_amount/2;i++) {
+ ex= W/2 + 900 * Math.cos((_spaceship.d+0.01*i) *Math.PI);
+ ey= H/2 + 900 * Math.sin((_spaceship.d+0.01*i) *Math.PI);
+ _shots.push(new ShotI(ex,ey,_spaceship.d));
+ ex= W/2 + 900 * Math.cos((_spaceship.d-0.01*i) *Math.PI);
+ ey= H/2 + 900 * Math.sin((_spaceship.d-0.01*i) *Math.PI);
+ _shots.push(new ShotI(ex,ey,_spaceship.d));
+ shots_counter += 2;
+ }
+ _spaceship.shotI_bank -= 1;
+ }
+ else if(_spaceship.fire_mode == 1){
+ ex= W/2 + _spaceship.shotII_range * Math.cos(_spaceship.d *Math.PI);
+ ey= H/2 + _spaceship.shotII_range * Math.sin(_spaceship.d *Math.PI);
+ _electrics.push(new ShotII(ex,ey,_spaceship.d));
+ _spaceship.shotII_range = 50;
+ shots_counter += 1;
+
+ }
+}
+function increaseUpgradeLvl(){
+ _spaceship.upgrade_lvl+=1;
+}
+function helpToggle(){
+ _spaceship.help_flag += 1;
+ _spaceship.help_flag %= 2;
+}
+function firemodeToggle(){
+ _spaceship.fire_mode += 1;
+ _spaceship.fire_mode %= 2;
+}
+function refillToggle(){
+ _spaceship.fuel = _spaceship.fuel_capacty;
+ _spaceship.pts -= 500;
+ zzfx(...[2.14,,32,.08,.4,.3,,1.94,,,4,.07,.15,,,.1,.12,.52,.02]);
+}
+function impFuelCapacityToggle(){
+ _spaceship.fuel_capacty += 50;
+ _spaceship.fuel = _spaceship.fuel_capacty;
+ _spaceship.pts -= (_spaceship.upgrade_lvl+1)*_spaceship.upgrade_factor;
+ increaseUpgradeLvl();
+ hide_selected_btns();
+}
+function improveShootToggle(){
+ _spaceship.spread_amount += 2;
+ _spaceship.pts -= (_spaceship.upgrade_lvl+1)*_spaceship.upgrade_factor;
+ increaseUpgradeLvl();
+ hide_selected_btns();
+ zzfx(...[2.14,,32,.08,.4,.3,,1.94,,,4,.07,.15,,,.1,.12,.52,.02]);
+}
+function improveSpeedToggle(){
+ _spaceship.speed_lower_limit += 1.5;
+ _spaceship.pts -= (_spaceship.upgrade_lvl+1)*_spaceship.upgrade_factor;
+ increaseUpgradeLvl();
+ _spaceship.speed_mode = 0;
+ _spaceship.speed = _spaceship.speed_lower_limit;
+ hide_selected_btns();
+ zzfx(...[2.14,,32,.08,.4,.3,,1.94,,,4,.07,.15,,,.1,.12,.52,.02]);
+}
+function changeSpeedToggle(){
+ var curr = _spaceship.speed_mode;
+ var next = (curr+1)%2;
+ _spaceship.speed_mode = next;
+
+ if (next == 0) {
+ _spaceship.speed_mode = 0;
+ _spaceship.speed = _spaceship.speed_lower_limit;
+ _spaceship.fuel_penalty = 0;
+ }
+ else if(_spaceship.fuel<=0) {
+ _spaceship.speed_mode = 0;
+ _spaceship.speed = _spaceship.speed_lower_limit;
+ _spaceship.fuel_penalty = 0;
+ return;
+ }
+ else{
+ _spaceship.speed_mode = 1;
+ _spaceship.speed = 2 * _spaceship.speed_lower_limit;
+ _spaceship.fuel_penalty = 1;
+ }
+}
+function LevelUp(){
+ btns_arr[1].drawFlag = btns_arr[2].drawFlag = btns_arr[3].drawFlag = 1;
+ btns_arr[0].color = "rgba(255, 255, 255, 0.3)";
+ upgrade_request = 1;
+
+ for(var i=0;i<5;i++) m.push(createRandomMeteor());
+}
+function hide_selected_btns(){
+ btns_arr[1].drawFlag = btns_arr[2].drawFlag = btns_arr[3].drawFlag = 0;
+ upgrade_request = 0;
+ btns_arr[0].color = "rgba(255, 255, 255, 0.3)";
+}
+onkeydown = onkeyup = function(e){
+ e = e || event;
+ var key = e.keyCode || e.key ;
+ map[key] = e.type == 'keydown';
+ clearTimeout(shot_timeout);
+ clearTimeout(help_timeout);
+ clearTimeout(firemode_timeout);
+ clearTimeout(speed_timeout);
+ this.clearTimeout(upgrade_timeout);
+ if (map[68] || map[39]){
+ _spaceship.d += _steering;
+ }
+ if (map[65] || map[37]){
+ _spaceship.d -= _steering;
+ }
+ if (_spaceship.d < 0) _spaceship.d += 2;
+ _spaceship.d %= 2;
+
+ var req_pts = (_spaceship.upgrade_lvl+1)*_spaceship.upgrade_factor;
+ if (map[32]) {
+ shot_timeout = setTimeout(shoot_handler,30);
+ }
+ if (map[72]) {
+ help_timeout = setTimeout(helpToggle,30);
+ }
+ if (map[88]) {
+ firemode_timeout = setTimeout(firemodeToggle,30);
+ }
+
+ if (map[49] && _spaceship.pts>=req_pts){
+ impFuelCapacityToggle();
+ }
+ if (map[50] && _spaceship.pts>=req_pts){
+ improveShootToggle();
+ }
+
+ if (map[51] && _spaceship.pts>=req_pts){
+ improveSpeedToggle();
+ }
+ if ((map[83] || map[38]) && _spaceship.fuel > 0){
+ speed_timeout = setTimeout(changeSpeedToggle,30);
+ }
+ if ((map[40]) && _spaceship.fuel > 0){
+ _spaceship.speed_mode = (_spaceship.speed_mode-1)%3;
+ speed_timeout = setTimeout(changeSpeedToggle,30);
+ }
+ if (map[71] && _spaceship.pts>=100){
+ Spaceship_Acc_Factor += 1;
+ _spaceship.pts -= 100;
+ }
+ if (map[86] && _spaceship.pts>= req_pts){
+ upgrade_timeout = setTimeout(LevelUp,30);
+ }
+}
+
+function fuel_refill(){
+ if(_spaceship.fuel<_spaceship.fuel_capacty) _spaceship.fuel+=3;
+ else _spaceship.speed_mode = 0;
+
+}
+setInterval(fuel_refill,500);
+function shootI_reload(){
+ if(_spaceship.shotI_bank<_spaceship.shotI_capacity) _spaceship.shotI_bank += 1;
+}
+setInterval(shootI_reload,1000);
+
+function shotII_reload(){
+ if(_spaceship.shotII_range<_spaceship.shotII_max_range)
+ _spaceship.shotII_range += 100;
+}
+setInterval(shotII_reload,1000);
+
+function gameLoop() {
+ ctx.clearRect(0,0,W,H);
+
+ ctx.fillStyle = "#150050";
+ ctx.fillRect(0,0,W,H);
+ for (var i=0;i<_STARS_NUM;i++){
+ _stars[i].draw();
+ _stars[i].update(_spaceship.d);
+ }
+
+ _spaceship.draw();
+ Spaceship_NINTH = 5;
+
+ for (var i=0;i<_METEORS_NUM;i++){
+ m[i].update(_spaceship.d);
+ m[i].draw();
+ }
+
+ for (var i=0;i<_METEORS_NUM;i++){
+ for (var j=i+1;j<_METEORS_NUM;j++){
+ if (distance(m[i],m[j])<=Math.max(m[i].r,m[j].r)){
+ colls.push(new Collision (m[i].x,m[i].y));
+ m[i].reset();
+ m[j].reset();
+ play(m[i].soundlst,30,.19,.18,.2,.05,0,'sine');
+ hit_sound();
+ }
+ }
+ if (distance(_spaceship,m[i])<=Math.max(m[i].r,_spaceship.r)) {
+ _spaceship.life -= 25;
+ m[i].reset();
+ play(m[i].soundlst,30,.19,.18,.2,.05,0,'sine');
+ hit_sound();
+ colls.push(new Collision (W/2,H/2));
+ if (_spaceship.life <= 0) _spaceship.life_state = 1;
+ }
+ }
+
+ for (var i=0;i<_shots.length;i++){
+ for (var j=0;j<_METEORS_NUM;j++){
+ if (distance(_shots[i],m[j])<=m[j].r){
+ colls.push(new Collision (m[j].x,m[j].y));
+ play(m[j].soundlst,30,.19,.18,.2,.05,0,'sine');
+ m[j].reset();
+ _shots[i].flag=1;
+ hits_counter += 1;
+ _spaceship.pts += 100+Spaceship_Acc_Factor*_spaceship.acc;
+ break;
+ }
+ }
+ }
+
+ for (var i=0;i<_electrics.length;i++){
+ for (var j=0;j<_METEORS_NUM;j++){
+ var a = _electrics[i], b=m[j];
+ var m1 = (a.ey-a.sy)/(a.ex-a.sx);
+ var m2 = (b.y-H/2)/(b.x-W/2);
+ if (Math.abs(m1-m2)<0.3 && (a.sx < b.x && b.x < a.ex||
+ a.ex < b.x && b.x < a.sx
+ )){
+ colls.push(new Collision (m[j].x,m[j].y));
+ electric_hit_sound();
+ m[j].reset();
+ _electrics.ex = m[j].x;
+ _electrics.ey = m[j].y;
+ hits_counter += 1;
+ _spaceship.pts += 100+Spaceship_Acc_Factor*_spaceship.acc;
+ break;
+ }
+ }
+ }
+ _electrics = _electrics.filter(function(value,index,arr){
+ return value.flag == 0;
+ });
+ for (var i=0;i<_electrics.length;i++){
+ _electrics[i].draw();
+ _electrics[i].update();
+ }
+ for (var i=0;i<_shots.length;i++){
+ _shots[i].draw(_spaceship.d);
+ _shots[i].update();
+ }
+ _shots= _shots.filter(function(value,index,arr){
+ return value.flag == 0;
+ });
+
+
+
+
+ for (var i=0;i0) _spaceship.acc = Math.floor((hits_counter / shots_counter)*100);
+
+ if(_spaceship.pts>=(_spaceship.upgrade_lvl+1)*+_spaceship.upgrade_factor && upgrade_request == 0) {
+ btns_arr[0].color = "white";
+ }
+ else {
+ btns_arr[0].color = "rgba(255, 255, 255, 0.3)";
+ }
+ Interface_Buttons.drawLoop();
+
+ if (_spaceship.fire_mode == 0) ShotI.drawHood();
+ else ShotII.drawHood();
+}
+
+
+window.mobileAndTabletCheck = function() {
+ let check = false;
+ (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent||navigator.vendor||window.opera);
+ return check;
+ };
+
+if(!mobileAndTabletCheck()){
+ _spaceship.mobile_flag = 0;
+ window.setInterval(gameLoop,30);
+}
+
+else {
+ _spaceship.mobile_flag = 1;
+ window.setInterval(gameLoop,30);
+}
diff --git a/Space Gun/js/interface.js b/Space Gun/js/interface.js
new file mode 100644
index 00000000..96e1269b
--- /dev/null
+++ b/Space Gun/js/interface.js
@@ -0,0 +1,275 @@
+class InterfaceButtons {
+ constructor(arr){
+ this.arr = arr;
+ }
+ pressedLoop(pressedArr){
+ for (var i=0;i=(_spaceship.upgrade_lvl+1)*_spaceship.upgrade_factor) impFuelCapacityToggle();
+}
+function threelines_draw(ref,color){
+ ctx.strokeStyle = color;
+ ctx.save();
+ ctx.beginPath();
+ ctx.translate(ref.x,ref.y);
+ ctx.moveTo(-10,0);
+ ctx.lineTo(15,0);
+ ctx.moveTo(-10,0);
+ ctx.lineTo(Math.sqrt(168),7.5);
+ ctx.moveTo(-10,0);
+ ctx.lineTo(Math.sqrt(168),-7.5);
+ ctx.moveTo(-3,-12);
+ ctx.lineTo(3,-12);
+ ctx.moveTo(0,-15);
+ ctx.lineTo(0,-9);
+ ctx.stroke();
+ ctx.closePath();
+ ctx.restore();
+}
+function imp_shoot_draw(){
+ if (_spaceship.pts<(_spaceship.upgrade_lvl+1)*_spaceship.upgrade_factor) threelines_draw(this,"red");
+ else threelines_draw(this,"white");
+}
+function imp_shoot_funct(){
+ if(_spaceship.pts>=(_spaceship.upgrade_lvl+1)*_spaceship.upgrade_factor) improveShootToggle();
+}
+function speedometer_draw(ref,color,state){
+ ctx.strokeStyle = color;
+ ctx.fillStyle = color;
+ ctx.save();
+ ctx.beginPath();
+ ctx.translate(ref.x,ref.y);
+ ctx.arc(0,0,13,0,Math.PI,true);
+ ctx.moveTo(-13,0);
+ ctx.lineTo(-9,0);
+ ctx.moveTo(13,0);
+ ctx.lineTo(9,0);
+ ctx.moveTo(0,-13);
+ ctx.lineTo(0,-9);
+ ctx.moveTo(9.19,-9.19);
+ ctx.lineTo(7.07,-7.07);
+ ctx.moveTo(-9.19,-9.19);
+ ctx.lineTo(-7.07,-7.07);
+ if (state ==0) {
+ ctx.moveTo(0,0);
+ ctx.lineTo(-8.57,-4.95);
+ }
+ else if(state==1){
+ ctx.moveTo(0,0);
+ ctx.lineTo(8.57,-4.95);
+ }
+ ctx.stroke();
+ ctx.closePath();
+ ctx.restore();
+}
+function imp_speed_draw(){
+ if (_spaceship.pts<(_spaceship.upgrade_lvl+1)*_spaceship.upgrade_factor) speedometer_draw(this,"red",2);
+ else speedometer_draw(this,"white",1);
+ ctx.save();
+ ctx.beginPath();
+ ctx.translate(this.x,this.y);
+ ctx.moveTo(-2,0);
+ ctx.lineTo(2,0);
+ ctx.moveTo(0,7);
+ ctx.lineTo(0,13);
+ ctx.moveTo(-3,10);
+ ctx.lineTo(3,10);
+ ctx.stroke();
+ ctx.closePath();
+ ctx.restore();
+}
+function imp_speed_funct(){
+ if (_spaceship.pts>=(_spaceship.upgrade_lvl+1)*_spaceship.upgrade_factor) improveSpeedToggle();
+}
+function chg_speed_mode_draw(){
+ var currMode = _spaceship.speed_mode;
+ if (_spaceship.fuel == 0) {
+ speedometer_draw(this,"red",currMode);
+ return;
+ }
+ speedometer_draw(this,"white",currMode);
+}
+function chg_speed_mode_funct(){
+ changeSpeedToggle();
+}
+function imp_modal_draw(){
+ ctx.save();
+ ctx.beginPath();
+ ctx.fillStyle = this.color;
+ var rand = Math.random();
+ if (rand>2/3) ctx.shadowBlur = 10;
+ ctx.closePath();
+ ctx.beginPath();
+
+
+ ctx.translate(this.x,this.y);
+ ctx.fillRect(-this.r/3,-this.r/6,this.r*2/3,this.r*5/6);
+ ctx.closePath();
+ ctx.beginPath();
+ ctx.translate(0,-this.r/2);
+ ctx.moveTo(0,-this.r*1/3);
+ ctx.rotate(Math.PI*2/3);
+ ctx.lineTo(0,-this.r*2/3);
+ ctx.rotate(Math.PI*2/3);
+ ctx.lineTo(0,-this.r*2/3);
+ ctx.closePath();
+ ctx.fill();
+ ctx.restore();
+}
+function imp_modal_funct(){
+ LevelUp();
+}
+const btn_size = 15;
+var b1 = new ButtonCircle(50,110,btn_size,"Shoot",
+ ()=>!_spaceship.mobile_flag?"'space'":"",shoot_btn_funct,shoot_btn_draw,1);
+var b2 = new ButtonCircle(W-90,110,btn_size,"Shot Mode",
+ ()=> !_spaceship.mobile_flag?"'x'":"",chg_shoot_mode_funct,chg_shoot_mode_draw,1);
+var b3 = new ButtonCircle(W/2-120,H/2+80,2*btn_size,"Inc. Fuel",
+ ()=>_spaceship.pts<(_spaceship.upgrade_lvl+1)*_spaceship.upgrade_factor?
+ "":
+ !_spaceship.mobile_flag?"'1'":"",
+ fuel_btn_funct,fuel_btn_draw,0);
+var b4 = new ButtonCircle(W/2,H/2+80,2*btn_size,"Imp. Spread",
+ ()=>_spaceship.pts<(_spaceship.upgrade_lvl+1)*_spaceship.upgrade_factor?
+ "":
+ !_spaceship.mobile_flag?"'2'":"",
+ imp_shoot_funct,imp_shoot_draw,0);
+var b5 = new ButtonCircle(W/2+120,H/2+80,2*btn_size,"Imp. Speed",
+ ()=>_spaceship.pts<(_spaceship.upgrade_lvl+1)*_spaceship.upgrade_factor?
+ "":
+ !_spaceship.mobile_flag?"'3'":"",
+ imp_speed_funct,imp_speed_draw,0);
+var b6 = new ButtonCircle(W-90,190,btn_size,"Speed Mode",
+ ()=> !_spaceship.mobile_flag?"'UP-DN'":"",chg_speed_mode_funct,chg_speed_mode_draw,1);
+var b7 = new ButtonCircle(70,H-100,btn_size*2,"",
+ ()=>_spaceship.pts<(_spaceship.upgrade_lvl+1)*_spaceship.upgrade_factor?
+ "":
+ !_spaceship.mobile_flag?"'v'":"",imp_modal_funct,imp_modal_draw,1);
+
+b7.color = "rgba(255, 255, 255, 0.3)";
+var btns_arr = [b7,b3,b4,b5,b1,b2,b6];
+var Interface_Buttons = new InterfaceButtons(btns_arr);
diff --git a/Space Gun/js/meteor.js b/Space Gun/js/meteor.js
new file mode 100644
index 00000000..ed33469c
--- /dev/null
+++ b/Space Gun/js/meteor.js
@@ -0,0 +1,133 @@
+
+const Meteor_plate = ["rgba(255, 36, 66,","rgba(255, 103, 231,","rgba(214, 42, 208,","rgba(224, 82, 151,"];
+class Meteor {
+ constructor(sx,sy,ex,ey,r, dt){
+ this.sx = sx;
+ this.sy = sy;
+ this.ex = ex;
+ this.ey = ey;
+ this.dt = dt;
+ this.d = Math.random()*2;
+
+ this.x = sx;
+ this.y = sy;
+ this.r = r ;
+ this.t = 0;
+
+ this.colorI = Math.floor(Math.random()*4);
+ this.color = this.pick_color(1,this.colorI);
+ this.soundlst = randomCollisionSound();
+ }
+ draw(){
+
+ ctx.save();
+ ctx.translate(this.x,this.y);
+ ctx.rotate(this.d*Math.PI);
+
+ ctx.beginPath();
+
+ var c = this.color;
+ ctx.fillStyle = c;
+ ctx.strokeStyle = c;
+ ctx.shadowColor = this.pick_color(1,2);
+ ctx.shadowBlur=150;
+ ctx.arc(0,0,this.r,0,2*Math.PI,true);
+ ctx.fill();
+ ctx.beginPath();
+
+ ctx.fillStyle = "rgba(256,256,256,0.8)";
+ ctx.arc(0,0+this.r*3/4,this.r/4,0,2*Math.PI,true);
+ ctx.fill();
+ ctx.closePath();
+
+ ctx.restore();
+ ctx.save();
+ ctx.beginPath();
+ for (var i=9;i>6;i--){
+ var prev = linear_A_to_B(this.sx,this.sy,this.ex,this.ey,this.t-this.t*(10-i)/80);
+ var c1 = this.pick_color((10-i)/10,this.colorI);
+ ctx.fillStyle = c1;
+ ctx.arc(prev[0],prev[1],this.r*i/10,0,2*Math.PI,true);
+ ctx.fill();
+
+ }
+
+
+
+ ctx.closePath();
+
+ ctx.restore();
+
+ }
+ pick_color(o,i){
+ return Meteor_plate[i]+o+")";
+ }
+ update(d){
+ var ninth = calcNINTH(this.x,this.y);
+ var flag = ninth[0]==0&&ninth[1]==0?1:0;
+ if (this.t>1.5 && !flag) {
+ this.reset();
+ }
+ v = _spaceship.speed;
+
+ dx = v * Math.cos(d*Math.PI);
+ dy = v * Math.sin(d*Math.PI);
+
+ this.sx -= dx;
+ this.ex -= dx;
+ this.sy -= dy;
+ this.ey -= dy;
+
+ this.t+= this.dt;
+ var new_pt = linear_A_to_B(this.sx,this.sy,this.ex,this.ey,this.t);
+ this.x = new_pt[0];
+ this.y = new_pt[1];
+
+ this.dt += 0.0000001;
+ this.d += Math.random()/10;
+ }
+ reset(){
+ var nm = createRandomMeteor();
+ Object.assign(this,nm);
+
+ }
+}
+function linear_A_to_B (x1,y1,x2,y2,t) {
+ return [(1-t)*x1+t*x2,(1-t)*y1+t*y2];
+}
+
+function createRandomMeteor(){
+ var _boxW = W;
+ var _boxH = H;
+ var ex = Math.random()*W;
+ var ey = Math.random()*H;
+ var w = Math.random()*3*W -W;
+ var h = Math.random()*3*H -H;
+ var flag = calcNINTH(h,w);
+ while(flag[0]==0 && flag[1]==0){
+ var w = Math.random()*3*W -W;
+ var h = Math.random()*3*H -H;
+ flag = calcNINTH(w,h);
+ }
+ var dt = Math.random()/550+1/150;
+ return new Meteor(w,h,ex,ey,Math.random()*6+15,dt);
+}
+function meteors(num){
+ arr = [];
+ for (var i=0;i{
+ try{
+ with(A=new AudioContext)
+ with(G=createGain())
+ for(i of notes){
+ with(O=createOscillator()){
+ connect(G),
+ G.connect(destination),
+ start(i[0]*interval),
+ frequency.setValueAtTime(center*1.06**(13-i[1]),i[0]*interval),
+ type=waveform,
+ gain.setValueAtTime(volume,i[0]*interval),
+ gain.setTargetAtTime(1e-5,i[0]*interval+decaystart,decayduration),
+ stop(i[0]*interval+duration);
+ }
+ }
+ }
+ finally{
+
+ }
+ }
+
+zzfxV=.5 // volume
+zzfx= // play sound
+(p=1,k=.05,b=220,e=0,r=0,t=.1,q=0,D=1,u=0,y=0,v=0,z=0,l=0,E=0,A=0,F=0,c=0,w=1,m=0,B=0)=>{let
+M=Math,R=44100,d=2*M.PI,G=u*=500*d/R/R,C=b*=(1-k+2*k*M.random(k=[]))*d/R,g=0,H=0,a=0,n=1,I=0
+,J=0,f=0,x,h;e=R*e+9;m*=R;r*=R;t*=R;c*=R;y*=500*d/R**3;A*=d/R;v*=d/R;z*=R;l=R*l|0;for(h=e+m+
+r+t+c|0;aa?0:(az&&(b+=v,C+=v,n=0),!l||++I%l||(b=C,u=G,n=n||1);p=zzfxX.createBuffer(1,h,R);p.
+getChannelData(0).set(k);b=zzfxX.createBufferSource();b.buffer=p;b.connect(zzfxX.destination
+);b.start();return b};zzfxX=new (window.AudioContext||webkitAudioContext) // audio context
+
+function hit_sound(){
+ zzfx(...[zzfxV,,49,.03,.01,.93,4,4.94,,,,,.06,.8,,.8,.28,.58,.04,.05]); // Explosion 228
+}
+function electric_hit_sound(){
+ zzfx(...[zzfxV,,149,,.08,.16,,2.03,-1.5,.2,,,,.5,-45,.2,,.79,.06]); // Hit 383
+}
+
diff --git a/Space Gun/js/spaceship.js b/Space Gun/js/spaceship.js
new file mode 100644
index 00000000..7b603468
--- /dev/null
+++ b/Space Gun/js/spaceship.js
@@ -0,0 +1,144 @@
+var canvas = document.getElementById("_canvas");
+canvas.width = window.innerWidth;
+canvas.height = window.innerHeight;
+var ctx = canvas.getContext("2d");
+
+
+var _zoom = 0.6;
+
+W = canvas.width;
+H = canvas.height;
+
+Spaceship_Size = 16 *_zoom;
+
+
+Spaceship_NINTH = 5;
+Spaceship_Acc_Factor = 4;
+
+var r,d,v, dx, dy;
+var _dx,_dy;
+
+class Spaceship {
+ constructor(r,d){
+ this.r = r;
+ this.d = d;
+ this.x_speed;
+ this.y_speed;
+ this.engine = new Engine();
+ this.x = W/2;
+ this.y = H/2;
+ this.acc = 0;
+ this.pts = 0;
+ if(document.monetization && document.monetization.state === 'started') {
+ this.pts = 1499;
+ }
+ this.help_flag= 1;
+ this.life_state = 0;
+ this.fire_mode = 1;
+ this.spread_amount = 0;
+ this.shotI_bank = 3;
+ this.shotI_capacity = 3;
+ this.shotII_range = 200;
+ this.shotII_max_range = 900;
+
+ this.mobile_flag = 0;
+
+ this.speed_mode = 0;
+ this.speed = 3;
+ this.speed_lower_limit = 3;
+
+ this.life = 100;
+ this.fuel = 100;
+ this.fuel_capacty = 100;
+ this.fuel_penalty = 0;
+
+ this.upgrade_lvl = 0;
+ this.upgrade_factor = 1500;
+
+ this.update();
+
+ }
+
+ update(){
+ this.x_speed = this.speed*Math.cos(this.d * Math.PI);
+ this.y_speed = this.speed*Math.sin(this.d * Math.PI);
+ this .fuel -= this.fuel_penalty;
+ if (this.fuel <= 0) {
+ this.speed_mode = 0;
+ this.speed = this.speed_lower_limit;
+ this.fuel_penalty = 0;
+ this.fuel = 0;
+ }
+ }
+
+ reset(f){
+ var nm = new Spaceship(15,0);
+ Object.assign(this,nm);
+ this.mobile_flag = f;
+ m = meteors(_METEORS_NUM);
+ }
+
+ draw (){
+ this.update();
+ x = this.x;
+ y = this.y;
+ r = this.r;
+ d = this.d;
+
+ ctx.lineWidth = 2;
+ ctx.save();
+
+ spaceship_fig_draw(x,y,r,d);
+
+ this.engine.add(0,r*2/3);
+ this.engine.draw(this.d, this.x_speed,this.y_speed);
+
+ ctx.restore();
+
+ this.drawHood();
+ }
+ drawEngineFire(){
+
+ }
+ drawHood(){
+ ctx.font = '15px monospace';
+ ctx.fillStyle = "white";
+ ctx.strokeStyle = "white";
+ if (this.life<30) ctx.fillStyle = "red";
+ ctx.fillText('Life:'+this.life,W-100,H-50);
+ ctx.fillStyle = "white";
+ if(this.fuel<30) ctx.fillStyle = "red";
+ ctx.fillText('Fuel:'+this.fuel,W-100,H-30);
+ ctx.fillStyle = "white";
+ ctx.fillText('Accuracy:'+ this.acc+'%',W-130,30);
+ ctx.fillText('Hit Bonus:'+this.acc*Spaceship_Acc_Factor,W-130,50);
+ var pts = 'Level:'+(this.upgrade_lvl);
+ ctx.fillText(pts,W/2-.5*pts.length*7.5,30);
+
+ var req = (this.upgrade_lvl+1)*this.upgrade_factor;
+ var ratio = this.pts / req;
+ ctx.beginPath();
+ ctx.moveTo(W/3,45);
+ ctx.lineTo(Math.min(2*W/3,(1-ratio)*W/3 + ratio*2*W/3),45);
+ ctx.stroke();
+ ctx.strokeStyle = "rgba(255, 255, 255, 0.3)";
+ ctx.moveTo(W/3,45);
+ ctx.lineTo(2*W/3,45);
+ ctx.stroke();
+ ctx.closePath();
+
+ if (this.life_state == 1) {
+ ctx.font = '40px monospace';
+ ctx.strokeStyle = 'red';
+ ctx.strokeText("Game Over",W/2 - 4.5*20,H/2);
+ ctx.font = '20px monospace';
+ ctx.fillText("Shoot to restart",W/2 -8*10,H/2+40);
+ }
+ var text = "Hello Subscriber! Best Wishes, and Free Upgrade!";
+
+ if(document.monetization && document.monetization.state === 'started'){
+ ctx.fillText(text,W/2-.5*text.length*7.5,H-15);
+ }
+ }
+}
+
diff --git a/Space Gun/js/spaceship_favicon.js b/Space Gun/js/spaceship_favicon.js
new file mode 100644
index 00000000..eb66da03
--- /dev/null
+++ b/Space Gun/js/spaceship_favicon.js
@@ -0,0 +1,15 @@
+var canvas = document.createElement('canvas');
+canvas.width = 16;
+canvas.height = 16;
+var ctx = canvas.getContext('2d');
+_zoom=0.6;
+ctx.fillStyle="rgba(255, 255, 255, 0.85)";
+ctx.fillRect(0,0,16,16);
+spaceship_fig_draw(6,11,8,1.75);
+
+
+var link = document.createElement('link');
+link.type = 'image/x-icon';
+link.rel = 'shortcut icon';
+link.href = canvas.toDataURL("image/x-icon");
+document.getElementsByTagName('head')[0].appendChild(link);
\ No newline at end of file
diff --git a/Space Gun/js/spaceship_fig.js b/Space Gun/js/spaceship_fig.js
new file mode 100644
index 00000000..dac5283f
--- /dev/null
+++ b/Space Gun/js/spaceship_fig.js
@@ -0,0 +1,105 @@
+
+function triangle (x,y,r,d){
+ ctx.save();
+ ctx.beginPath();
+ ctx.rotate(d * Math.PI);
+ ctx.moveTo(x,y-2*r);
+
+ ctx.rotate(Math.PI/1.5);
+ ctx.lineTo(0,0-r);
+ ctx.lineTo(0,0);
+ ctx.closePath();
+ ctx.fillStyle = "#595260";
+ ctx.fill();
+ ctx.beginPath();
+ ctx.rotate(-Math.PI/1.5);
+ ctx.moveTo(x,y-2*r);
+ ctx.rotate(-Math.PI/1.5);
+ ctx.lineTo(0,0-r);
+ ctx.lineTo(0,0);
+ ctx.closePath();
+
+ ctx.closePath();
+ ctx.fillStyle= "#B2B1B9";
+ ctx.fill();
+ ctx.restore();
+}
+
+function spaceship_fig_draw(x,y,r,d){
+ ctx.beginPath();
+
+ ctx.translate(x,y);
+ ctx.rotate(Math.PI / 2);
+
+ triangle(0,0,r*_zoom,d);
+
+ ctx.rotate(d*Math.PI);
+ ctx.moveTo(0,r*2/3);
+ ctx.lineTo(0,r*2/3+10);
+}
+
+
+
+class Engine_Circle{
+ constructor(x,y,r){
+ this.x = x;
+ this.y = y;
+ this.r = r ;
+ this.dx = 0;
+ this.dy = 0;
+
+ this.color = this.pick_color();
+ }
+ draw(d){
+
+ ctx.save();
+ var c = this.color;
+ ctx.fillStyle = c;
+ ctx.strokeStyle = c;
+ ctx.beginPath();
+
+ ctx.arc(this.x,this.y,this.r,0,2*Math.PI,true);
+ ctx.closePath();
+ ctx.fill();
+ ctx.stroke();
+ ctx.restore();
+ }
+ pick_color(){
+ const plate = ["#FAAD80","#FF6767","#FF3D68","#A73489"];
+ var i = Math.floor(Math.random()*4);
+ return plate[i];
+ }
+ update(d){
+ v = _spaceship.speed;
+ var t0,t1,t2;
+ t0 = Math.random()/3 + 1/3;
+ t1 = Math.cos(t0 * Math.PI) * 100/v;
+ t2 = Math.sin(t0 * Math.PI) * 100/v;
+ this.dx = t1;
+ this.dy = t2;
+
+ this.x += this.dx /2;
+ this.y += this.dy /2;
+ }
+}
+class Engine{
+ constructor(){
+ this.arr = [];
+ }
+ add(x,y){
+ r = _zoom*Spaceship_Size/1.5*Math.random();
+ var c = new Engine_Circle(x,y,r);
+ this.arr.push(c);
+ }
+ draw(d, a,b){
+ v = _spaceship.speed;
+ var sx,sy;
+ sx = sy = 1;
+
+ for (var i=0;iv*0.5) this.arr.shift();
+ }
+ }
+}
diff --git a/Space Gun/js/weapon.js b/Space Gun/js/weapon.js
new file mode 100644
index 00000000..c3bf4145
--- /dev/null
+++ b/Space Gun/js/weapon.js
@@ -0,0 +1,200 @@
+shot_sx=W/2;
+shot_sy=H/2;
+shot_rx = 20;
+shot_ry = 2;
+shot_dt = 0.02;
+function Trapezoid (x,y,bottom_w,top_w,h){
+ ctx.save();
+ ctx.beginPath();
+ ctx.translate(x,y);
+ ctx.moveTo(-top_w/2,-h/2);
+ ctx.lineTo(top_w/2,-h/2);
+ ctx.lineTo(bottom_w/2,h/2);
+ ctx.lineTo(-bottom_w/2,h/2);
+ ctx.closePath();
+}
+var strokeTrapezoid = function(x,y,bottom_w,top_w,h){
+ Trapezoid(x,y,bottom_w,top_w,h);
+ ctx.stroke();
+ ctx.restore();
+};
+var fillTrapezoid = function (x,y,bottom_w,top_w,h){
+ Trapezoid(x,y,bottom_w,top_w,h);
+ ctx.fill();
+ ctx.restore();
+};
+class ShotI{
+ constructor(ex,ey,d){
+ this.sx = shot_sx;
+ this.sy = shot_sy;
+ this.ex =ex;
+ this.ey =ey;
+ this.x =shot_sx;
+ this.y =shot_sy;
+ this.t =0.01;
+ this.d = d;
+ this.flag = 0;
+
+ play([[0,5],[0,4],[0,3],[0,2],[0,1]],1000,.03,.1,.001,.2,.01,'sine');
+ }
+
+ draw(){
+ ctx.save();
+ var c = "#28FFBF";
+ ctx.shadowColor = c;
+ ctx.shadowBlur = 100;
+ ctx.fillStyle = c;
+ ctx.strokeStyle = c;
+ ctx.translate(0,0);
+ ctx.beginPath();
+ ctx.ellipse(this.x,this.y,shot_rx,shot_ry,this.d*Math.PI,0,2*Math.PI);
+ ctx.closePath();
+ ctx.fill();
+ ctx.restore();
+ }
+
+ static drawHood() {
+ ctx.save();
+ ctx.strokeStyle = "white";
+ ctx.fillStyle = "white";
+ ctx.lineWidth = 0.5;
+ var tmp = _spaceship.shotI_bank;
+ var p,l;
+ for (var i=1;i>-2;i--){
+ if (i%2==0) {
+ p=15;l=9;
+ }
+ else {
+ p=9;l=15;
+ }
+ if (tmp>0) {
+ strokeTrapezoid(W/2+i*17,H/2+25,p,l,3);
+ fillTrapezoid(W/2+i*17,H/2+25,p,l,3);
+ tmp -= 1;
+ }
+ else {
+ strokeTrapezoid(W/2+i*17,H/2+25,p,l,3);
+ }
+ }
+ ctx.restore();
+ }
+
+ update(){
+
+ v = _spaceship.speed+4;
+ dx = v * Math.cos(this.d*Math.PI);
+ dy = v * Math.sin(this.d*Math.PI);
+
+ this.sx -= dx;
+ this.ex -= dx;
+ this.sy -= dy;
+ this.ey -= dy;
+
+ this.t+= shot_dt;
+ var new_pt = linear_A_to_B(this.sx,this.sy,this.ex,this.ey,this.t);
+ this.x = new_pt[0];
+ this.y = new_pt[1];
+
+ if(this.t>1) this.flag=1;
+ }
+}
+
+class ShotII{
+ constructor(ex,ey,d){
+ this.sx = shot_sx;
+ this.sy = shot_sy;
+ this.ex =ex;
+ this.ey =ey;
+ this.MaxLen = Math.sqrt(Math.pow(this.ex-W/2,2)+Math.pow(this.ey-H/2,2));
+ this.x =shot_sx;
+ this.y =shot_sy;
+ this.t =0;
+ this.d = d;
+ this.flag = 0;
+ zzfx(...[zzfxV,,152,.01,.01,0,4,.24,24,,826,.01,,,-27,,.49,.5,.02]); // Blip 213
+ }
+ draw(){
+ ctx.save();
+ var c = "#FAFF00";
+ ctx.fillStyle = c;
+ ctx.strokeStyle = c;
+ ctx.shadowColor = "white";
+ ctx.beginPath();
+ ctx.translate(W/2,H/2);
+ ctx.rotate(this.d*Math.PI);
+ ctx.moveTo(0,0);
+ var len = this.t * this.MaxLen;
+ var fractions = Math.floor(Math.random()*6)+4;
+ var width = Math.random()*20+0.5;
+ for (var i=0;i<=fractions-1;i++){
+ var curr_x = (i/fractions)*len;
+ var next_x = ((i+1)/fractions)*len;
+
+ var blur = Math.random()*20;
+
+ var rand_x = Math.random()*(next_x-curr_x) +curr_x;
+ var rand_y = (Math.random()-0.5)*(next_x-curr_x);
+ ctx.lineWidth = (width*(fractions-i))/fractions;
+ ctx.shadowBlur = blur;
+ ctx.lineTo(rand_x,rand_y);
+ ctx.moveTo(rand_x,rand_y);
+ ctx.lineTo(next_x,0);
+ ctx.moveTo(next_x,0);
+ }
+
+ ctx.lineTo(len,0);
+ ctx.closePath();
+ ctx.stroke();
+ ctx.shadowColor = "white";
+ ctx.shadowBlur = 25;
+ ctx.restore();
+ }
+
+ update(){
+ v = _spaceship.speed*2;
+ dx = v * Math.cos(this.d*Math.PI);
+ dy = v * Math.sin(this.d*Math.PI);
+
+ this.sx -= dx;
+ this.ex -= dx;
+ this.sy -= dy;
+ this.ey -= dy;
+
+ this.t+= shot_dt*10;
+ var new_pt = linear_A_to_B(this.sx,this.sy,this.ex,this.ey,this.t);
+
+ this.x = new_pt[0];
+ this.y = new_pt[1];
+
+ if(this.t>1) this.flag=1;
+ }
+ static drawHood() {
+ ctx.save();
+ ctx.strokeStyle = "white";
+ ctx.fillStyle = "white";
+ ctx.lineWidth = 0.5;
+
+ var tmp = _spaceship.shotII_range;
+ var max = _spaceship.shotII_max_range;
+ strokeTrapezoid(W/2,H/2+25,20,20,3);
+ fillTrapezoid(W/2,H/2+25,20*(tmp/max),20*(tmp/max),3);
+
+ ctx.restore();
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Zurbo Game/manifest.json b/Space Gun/manifest.json
similarity index 55%
rename from Zurbo Game/manifest.json
rename to Space Gun/manifest.json
index 007f855b..86630a5d 100644
--- a/Zurbo Game/manifest.json
+++ b/Space Gun/manifest.json
@@ -1,9 +1,9 @@
{
- "name": "Zurbo Game",
- "short_name": "Zurbo",
- "description": "A fun game to play",
+ "name": "Space Gun",
+ "short_name": "Space_Gun",
+ "description": "A fun game to play.",
"start_url": "index.html",
"display": "standalone",
"background_color": "#f9f9f9",
"theme_color": "#006400"
-}
\ No newline at end of file
+ }
\ No newline at end of file
diff --git a/Space Gun/smallImage.png b/Space Gun/smallImage.png
new file mode 100644
index 00000000..a7998857
Binary files /dev/null and b/Space Gun/smallImage.png differ
diff --git a/Zurbo Game/index.html b/Zurbo Game/index.html
deleted file mode 100644
index d4260f03..00000000
--- a/Zurbo Game/index.html
+++ /dev/null
@@ -1,5474 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file