title: Movement doesn't work after applying functions to draw shape?
body: <p>I'm trying to create a simple space game using Processing.
  I've drawn a spaceship and added movements to it using A, D, W, S keys. Here's the code:</p>
  <pre><code>float shipX=0;
  float shipY=0; 
  
  
  void setup(){
    size(500,500);
  
  }
  
  void draw(){
    background(0);
    stroke(0); //spaceship
    strokeWeight(2);
    fill(#F5F5F5);
    circle(shipX,shipY,50);
    fill(0);
    circle(shipX,shipY,20);
    triangle(shipX,shipY,shipX-8,shipY+25,shipX+8,shipY+25);
    fill(105,105,105);
    rect(shipX-20,shipY+20,40,5);
    rect(shipX-25,shipY+25,50,15);
    fill(255,255,0);
    triangle(shipX-25,shipY+25,shipX-40,shipY+35,shipX-25,shipY+40);
    triangle(shipX+25,shipY+25,shipX+40,shipY+35,shipX+25,shipY+40);
    fill(#F5F5F5);
    arc(shipX,shipY+40,50,20,0,PI, CHORD);  
    
  }
    void keyPressed(){ //spaceship movement
      if(key == 's')
      shipY = shipY+10;
      if(key=='w')
      shipY = shipY-10;
      if(key =='a')
      shipX= shipX-5;
      if(key =='d')
      shipX= shipX+5;
    }
  </code></pre>
  <p>Later on, I want to call <code>void drawPlayer(float x, float y)</code> to draw the ship instead.</p>
  <p>However, after drawing the player by calling <code>drawPlayer(0,0);</code> in <code>void draw()</code>, the movements don't work anymore. Here's the new block of code:</p>
  <pre><code>float x=0;
  float y=0;
  
  void setup(){
    size(500,500);
   
  }
  
  void draw(){
    background(0);
    drawPlayer(50,50);
    }
  
    void drawPlayer(float x, float y){
    stroke(0); //spaceship
    strokeWeight(2);
    fill(#F5F5F5);
    circle(x,y,50);
    fill(0);
    circle(x,y,20);
    triangle(x,y,x-8,y+25,x+8,y+25);
    fill(105,105,105);
    rect(x-20,y+20,40,5);
    rect(x-25,y+25,50,15);
    fill(255,255,0);
    triangle(x-25,y+25,x-40,y+35,x-25,y+40);
    triangle(x+25,y+25,x+40,y+35,x+25,y+40);
    fill(#F5F5F5);
    arc(x,y+40,50,20,0,PI,CHORD);
  
    }
  
    void keyPressed(){ //spaceship movement
      if(key == 's')
      y = y + 10;
      if(key =='w')
      y = y - 10;
      if(key =='a')
      x= x - 5;
      if(key =='d')
      x= x + 5;
    }
  </code></pre>
  <p>I'm new to programming, so things get confusing. Is it because the global variable x, y is not called? I've tried putting movements function into <code>void drawPlayer(float x, float y)</code> but the ship still can't move. It would be great if anyone can help me with this. Thank you!</p>