# How to make head wiggle?

**URL:** https://discourse.processing.org/t/how-to-make-head-wiggle/3657
**Category:** Coding Questions
**Created:** [September 18, 2018, 7:29pm UTC](https://discourse.processing.org/t/how-to-make-head-wiggle/3657 "2018-09-18T19:29:59Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![RienziDeal](https://avatars.discourse-cdn.com/v4/letter/r/df788c/32.png) [@RienziDeal](https://discourse.processing.org/u/RienziDeal)
#### Post date: [September 18, 2018, 7:29pm UTC](https://discourse.processing.org/t/how-to-make-head-wiggle/3657/1 "2018-09-18T19:29:59Z")

</div>

Hi this is my code

* * *

```auto
void setup() {
    
size(200,250);
  
background(255);
smooth();
ellipseMode(CENTER);
rectMode(CENTER); 

  } 
  
  void draw() {
  background (255, 50,0); 
  body(); 
  head(); 
  float x = 0; 
 
  
  

  }
  
void body() {
stroke(0);
//body
fill(255);
ellipse(105,83,30,20);
ellipse(103,98,25,18);
ellipse(98,113,25,18);
ellipse(118,120,18,18);
ellipse(138,120,18,18);
ellipse(158,120,18,18);
ellipse(168,110,10,10);
//head
}
void head(){
ellipse(100,60,60,30); 
ellipse(85,40,20,30);
ellipse(115,40,20,30);
fill (random (250), random (250) , random (250)); 
rect(93,60,5,5); // Left Eye
fill (random (250), random (250) , random (250)); 
rect(107,60,5,5); // Right Eye '
}

```

* * *

I want to make the head move back and forth across the body

---

<div class="post-metadata">

### Author: ![Pyrros](https://avatars.discourse-cdn.com/v4/letter/p/49beb7/32.png) [@Pyrros](https://discourse.processing.org/u/Pyrros)
#### Post date: [September 18, 2018, 7:53pm UTC](https://discourse.processing.org/t/how-to-make-head-wiggle/3657/2 "2018-09-18T19:53:54Z")

</div>

Well, you should probably work with classes, inheritance and PVectors. That would make it much easier. Try reading further in Nature of Code. 🙂

---

<div class="post-metadata">

### Author: ![tony](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tony/32/949_2.png) [@tony](https://discourse.processing.org/u/tony)
#### Post date: [September 18, 2018, 10:34pm UTC](https://discourse.processing.org/t/how-to-make-head-wiggle/3657/3 "2018-09-18T22:34:36Z")

</div>

In the future, please format your code. It makes it easier for us to read and understand your code, which can help us help you more quickly.

As for your actual question;

> [@RienziDeal](#):
>
> I want to make the head move back and forth across the body

I’m going to ask you to be more specific. A _lot_ more specific. Any sort of problem solving can be approached by breaking it into smaller, manageable pieces, and in this case, you might ask yourself:

- How would I make a shape “move”?
- What methods do I have at my disposal?
- What does it mean to “wiggle”

Once you’ve really defined the type of behavior you want in more specific terms, it will be easier to look at your toolset and start working on a solution.
