[SOLVED] Making Objects Solid White?

I recently downloaded a trial of Corona, and I’m beginning to love it already. It’s so easy to use and the multiplatform capabilities make it even better. Anyways, let’s get onto my question.

I just finished following a YouTube tutorial on how to make a game called “Breakout”. I was very satisfied with the result, but I was wondering how I could set the walls, ball, and paddle to be solid white. I tried using object:setFillColor(255, 255, 255), but it isn’t making it solid white. The colors remained the same as if that line didn’t exist.

main.lua
[lua]require(“physics”)

function main()
setUpPhysics()
createWalls()
createBricks()
createBall()
createPaddle()
startGame()
end

function setUpPhysics()
physics.start()
physics.setDrawMode(“hybrid”)
physics.setGravity(0,0)
end

function createWalls()
local wallThickness = display.contentHeight / 64
– Left Wall
local wall = display.newRect(0 , 0, wallThickness, display.contentHeight)
physics.addBody(wall, “static”, {friction = 0, bounce = 1})
wall:setFillColor(255, 255, 255)
– Right Wall
wall = display.newRect(display.contentWidth - wallThickness , 0, wallThickness, display.contentHeight)
physics.addBody(wall, “static”, {friction = 0, bounce = 1})
wall:setFillColor(255, 255, 255)
– Top Wall
wall = display.newRect(0 , 0, display.contentWidth, wallThickness)
physics.addBody(wall, “static”, {friction = 0, bounce = 1})
wall:setFillColor(255, 255, 255)
– Bottom Wall
wall = display.newRect(0 , display.contentHeight - wallThickness, display.contentWidth, wallThickness)
physics.addBody(wall, “static”, {friction = 0, bounce = 1})
wall:setFillColor(255, 255, 255)
wall.type = “Bottom”
end

function createBricks()
local brickWidth = display.contentWidth / 8
local brickHeight = display.contentHeight / 32
local numRows = 4
local numColumns = 6
local topLeft = {x = display.contentWidth / 2 - (brickWidth * numColumns) / 2, y = display.contentWidth / 8}
local row
local column

for row = 0, numRows - 1 do
for column = 0, numColumns - 1 do
local brick = display.newRect(topLeft.x + (column * brickWidth), topLeft.y + (row * brickHeight), brickWidth, brickHeight)
brick:setFillColor(math.random(50, 255), math.random(50, 255), math.random(50, 255))
brick.type = “Destructible”
physics.addBody(brick, “static”, {friction = 0, bounce = 1})
end
end
end

function createBall()
local ballRadius = display.contentWidth / 32
ball = display.newCircle(display.contentWidth / 2, display.contentHeight / 2, ballRadius)
ball:setFillColor(255, 255, 255)
physics.addBody(ball, “dynamic”, {friction = 0, bounce = 1, radius = ballRadius})
ball.collision = function(self, event)
if(event.phase == “ended”) then
if(event.other.type == “Destructible”) then
event.other:removeSelf()
end
if(event.other.type == “Bottom”) then
self:removeSelf()
local onTimerComplete = function(event)
createBall()
startGame()
end
timer.performWithDelay(0, onTimerComplete, 1)
end
end
end
ball:addEventListener(“collision”, ball)
end

function createPaddle()
local paddleWidth = display.contentWidth / 2.4
local paddleHeight = display.contentHeight / 64
local paddle = display.newRect(display.contentWidth / 2 - paddleWidth / 2, display.contentHeight - display.contentHeight / 9.6, paddleWidth, paddleHeight)
physics.addBody(paddle, “static”, {friction = 0, bounce = 1})
local movePaddle = function(event)
paddle.x = event.x
end
Runtime:addEventListener(“touch”, movePaddle)
end

function startGame()
ball:setLinearVelocity(math.random(-150, 150), display.contentWidth / 1.25)
end

display.setStatusBar(display.HiddenStatusBar)
main()[/lua] [import]uid: 103624 topic_id: 17637 reply_id: 317637[/import]

Hey there,

Comment out line 14; [lua]physics.setDrawMode(“hybrid”)[/lua]

They ARE white, you’re just seeing the physical bodies because you’ve got that turned on.

Peach :slight_smile: [import]uid: 52491 topic_id: 17637 reply_id: 67113[/import]

Thanks! [import]uid: 103624 topic_id: 17637 reply_id: 67114[/import]

No worries.

On a side note, please don’t make dupe threads - have deleted the other one. http://developer.anscamobile.com/forum/2011/05/05/forum-rules-and-guidelines

Thank you :slight_smile:

Peach [import]uid: 52491 topic_id: 17637 reply_id: 67117[/import]