My Paddle will only appear black

I am working on my first build and I have a paddle in my game that lets you bounce balls off of it. I want the paddle to be a green color but no matter what Ive tried, it just stays black. Any idea why? hers the coding I have in:

paddle = Paddle:new(“Assets/3krpaddle.png”)

physics.addBody(paddle, “static”, paddle.paddlePhysics)

gameGroup:insert(paddle)

paddle:addEventListener(“collision”, ballHitPaddle)

local paddleInteractBox = display.newRect(screenWidth/2, (screenHeight - screenHeight/4), screenWidth*3, screenHeight/2)

paddleInteractBox:setFillColor(0.1, 0.2, 0.3)

paddleInteractBox.isVisible = false

paddleInteractBox.isHitTestable = true

paddleInteractBox:addEventListener(“touch”, paddleTouch)

gameGroup:insert(paddleInteractBox)

I have tried changing the values of the setfillcolor but no luck there. 

Thanks!

I suspect we will need to see the code for Paddle:new()

Rob

Hi!

Hard to tell from your code. Your are using setFillColor on paddleInteractBox, not on paddle, which is puzzling.

Also, setFillColor sort of multiplies the original color value of your image with the new values. If your original image is black, this multiplication will result in zero, i.e. black. Is the paddle image by chance black? If so, make it white.

You’re definitely using setFillColor in the wrong place (in your code, you use setFillColor on paddleInteractBox, and then on the next line set paddleInteractBox.isVisible = false, making it invisible anyway).

Try using:

paddle = Paddle:new("Assets/3krpaddle.png") --Use set fill color here paddle:setFillColor(0.1, 0.2, 0.3) physics.addBody(paddle, "static", paddle.paddlePhysics) gameGroup:insert(paddle) paddle:addEventListener("collision", ballHitPaddle)

As thomas6 says, your paddle image will need to be white (or a very light greyscale) for setFillColor to work.

I suspect we will need to see the code for Paddle:new()

Rob

Hi!

Hard to tell from your code. Your are using setFillColor on paddleInteractBox, not on paddle, which is puzzling.

Also, setFillColor sort of multiplies the original color value of your image with the new values. If your original image is black, this multiplication will result in zero, i.e. black. Is the paddle image by chance black? If so, make it white.

You’re definitely using setFillColor in the wrong place (in your code, you use setFillColor on paddleInteractBox, and then on the next line set paddleInteractBox.isVisible = false, making it invisible anyway).

Try using:

paddle = Paddle:new("Assets/3krpaddle.png") --Use set fill color here paddle:setFillColor(0.1, 0.2, 0.3) physics.addBody(paddle, "static", paddle.paddlePhysics) gameGroup:insert(paddle) paddle:addEventListener("collision", ballHitPaddle)

As thomas6 says, your paddle image will need to be white (or a very light greyscale) for setFillColor to work.