View Single Post
  #1  
Old 01-02-2012, 05:06 PM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
My attempt at a grappling hook

I have made a pretty poor grappling hook and done it a weird way but oh well lol it still works. I was wondering if anyone would happen to have any knowledge on how to make it so you could hit a player and press a to reel them towards you maybe lmao.
Also how would I detect if it hits lets say for instance a bush? then it could change the bush tiles to cut down bush tiles, I know how that is done, Via tiles and updateboard.
But the detection of specific tiles I'm unsure of.
Here's my script so far.
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.pullin false;
  
this.shooting false;
  
this.pullable false;
}

function 
onWeaponFired() {
  
hideimgs(20010000);
  
this.dir player.dir;
  
this.sx player.1;
  
this.sy player.1.5;
  
this.shooting true;
  
onTimeout();
}

function 
onTimeout() {
  if (
this.shooting == true) {
    
showpoly(1, {
      
player.1player.1.5this.sxthis.sy
    
});
      
findimg(1).layer 0;
      
findimg(1).red 0;
      
findimg(1).green 1;
      
findimg(1).blue 0;
      
this.sx2 this.sx;
      
this.sy2 this.sy;
      if (
this.dir == && !onwall(this.sxthis.sy 0.5)) {
        
this.sy -= 0.5;
      }
      if (
this.dir == && !onwall(this.sx 0.5this.sy)) {
        
this.sx -= 0.5;
      }
      if (
this.dir == && !onwall(this.sxthis.sy 0.5)) {
        
this.sy += 0.5;
      }
      if (
this.dir == && !onwall(this.sx 0.5this.sy)) {
        
this.sx += 0.5;
      }
      
freezeplayer(1);
      if(
this.sx2 == this.sx && this.sy2 == this.sy){
      
Hit();
      
settimer(0);
      
findimg(1).red 1;
      
findimg(1).green 0;
      
findimg(1).blue 0;
      return;
      }
  }
  if (
this.pullin == true) {
    
freezeplayer(1);
    
showpoly(1, {
      
player.1player.1.5this.sxthis.sy
    
});
      
findimg(1).layer 0;
      
findimg(1).red 1;
      
findimg(1).green 0;
      
findimg(1).blue 0;
    if (
this.dir == && player.this.sy) {
      
player.-= 0.5;
    }
    if (
this.dir == && player.this.sy) {
      
player.+= 0.5;
    }
    if (
this.dir == && player.this.sx) {
      
player.-= 0.5;
    }
    if (
this.dir == && player.this.sx) {
      
player.+= 0.5;
    }
    if (
player.== this.sy) {
      if (
this.dir == || this.dir == 2) {
        
this.pullin false;
        
freezeplayer(0);
        
hideimg(1);
      }
    }
    if (
player.== this.sx) {
      if (
this.dir == || this.dir == 3) {
        
this.pullin false;
        
freezeplayer(0);
        
hideimg(1);
      }
    }
  }
  
settimer(0.05);
}

function 
Hit() {
  
this.pullable true;
  
player.chat "Press A to reel in!";
}

function 
onKeyPressed(codekey) {
  if (
key == "a" && this.pullable == true) {
    
this.pullable false;
    
this.shooting false;
    
this.pullin true;
    
onTimeout();
  }

__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote