# Ball doesn't appear

**URL:** <https://discourse.processing.org/t/ball-doesnt-appear/36568>\
**Category:** Processing.py\
**Tags:** homework\
**Created:** [April 24, 2022, 3:46am UTC](https://discourse.processing.org/t/ball-doesnt-appear/36568 "2022-04-24T03:46:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![maya](https://avatars.discourse-cdn.com/v4/letter/m/cab0a1/32.png) [@maya](https://discourse.processing.org/u/maya)\
**Post date:** [April 24, 2022, 3:46am UTC](https://discourse.processing.org/t/ball-doesnt-appear/36568/1 "2022-04-24T03:46:45Z")

</div>

Hi, for some reason, the ball in my code doesn’t show up. Do you know why?

```auto
add_library('sound')
import sys
count = 0 
ball = 0
countdown = 6 
dogs = [] 

def setup():
    global sf, x, bgImage, y, speed, acceleration, countdown, dogs, dog_img
    countdown = 6
    x, y = -50, -50
    speed = 2
    acceleration = 0.4
    size(800, 600)
    frameRate(1)
    sf = SoundFile(this,"backgroundmusic.mp3")
    sf.play()
    bgImage = loadImage("backgroundimage.jpeg")
    dog_img = loadImage("dog.png")
    first_dog = {'x':350, 'y':0} 
    dogs.append(first_dog) 

def draw():
    global bgImage, x, y, speed, dogs, count, ball, countdown, acceleration
    image(bgImage, 0, 0, width, height)
    textSize(50)
    
    if countdown > 0:
        countdown = countdown - 1
        text(countdown, width/2, height/2)
    if countdown == 0:
        for dog in dogs:
            image(dog_img, dog['x'], dog['y'])
            dog['y'] += 50
        dogs.append({'x':random(height), 'y':0})

    textSize(30)
    text("Score:", count, 40, 550)

    ellipse(x, y, 50, 50)
    y = y + speed
    speed = speed + acceleration
    if y > height:
        speed = speed * -1
        y = height
        
def mouseReleased():
    global x, y, speed
    x = mouseX
    y = mouseY
    speed = 1
        
    if count > 10:
        text("You won!", 100, 100)
        text("Press a key to exit", 50, 100)
        sys.exit()
        if count < 10:
            text("You lost!", 100, 100)
            text("Press a key to exit", 50, 100)
            sys.exit()

```

---

<div class="post-metadata">

**Author:** ![SomeOne](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/someone/32/8639_2.png) [@SomeOne](https://discourse.processing.org/u/SomeOne)\
**Post date:** [April 24, 2022, 4:41am UTC](https://discourse.processing.org/t/ball-doesnt-appear/36568/2 "2022-04-24T04:41:03Z")

</div>

For ellipse and all 2d shapes (rect, line, arc etc), you need to define a colour either for [fill](https://py.processing.org/reference/fill.html) or [stroke](https://py.processing.org/reference/stroke.html). Fill sets colour for filling the shape and stroke sets outline. As with all colour setting in processing in [colorMode()](https://py.processing.org/reference/colorMode.html) defines how processing will interpret given values.  
Keep in mind that setting fill() or stroke() may effect text colour too.

---

<div class="post-metadata">

**Author:** ![tabreturn](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tabreturn/32/3697_2.png) [@tabreturn](https://discourse.processing.org/u/tabreturn)\
**Post date:** [April 24, 2022, 4:46am UTC](https://discourse.processing.org/t/ball-doesnt-appear/36568/3 "2022-04-24T04:46:11Z")

</div>

I assume the ball is rendered using the `ellipse()` line? Have you checked the x-y coord values? Perhaps insert a `print()` line to test –

```python
    ...
    print(x, y) # do you see the values you expect in the console?
    ellipse(x, y, 50, 50)
    ...

```
