Codea 2.3.2 is out!

BUG REPORT.
images with black background are saved with a white background, see http://codea.io/talk/discussion/comment/65149/#Comment_65149

@Jmv38 how are you saving the image?

@Simeon, maybe online, I am too interested how to insert pictures from local host, and this topic actually was created befor I had 2.3.2 - I had 2.3 - that is the reason for not finished CargoBot codes. Can you please fix this that if you have an old version, it won’t restore CargoBot with errors? - Thx

Edit: In the project click the photo button. Save to local host in photos, email yourself, open computer, insert photo in websites, get link, paste link - easy!

@Simeon by pressing the picture save button while the game is running

BUG REPORT.
Write

background(0)  x

then press +=, you get

background(0)  = )  + x

i was expecting

background(0)  x = x + 

@Jmv38 that’ll teach you to put all your code on one line :tongue:

lol

@Jmv38 Don’t you need a semicolon after background(0); in order to tell Lua you want multiple statements on one line?

nope, a space is all you need

if the problem only happens with the background command, I wouldn’t bother fixing it.

@Simeon It’s caused because background isn’t within a function. If it’s put in setup() or draw() then there is a black background when the image is saved.

@dave1707 This may be the reason you see a black screen between the splash screen and the application

I tried running the code and just saving / canceling, saving / canceling and sometimes it was black, sometimes white.

@Simeon @Ignatz Actually if I keep starting the below code and save the image, the white and black background sometime alternate, sometimes it’s white for awhile, sometimes it’s black.

function setup()   
    background(0)
end

function draw()
    fill(255)
    ellipse(WIDTH/2,HEIGHT/2,200)
end

On the same line as@Jmv38 's bug, pressing += after a table instance, eg a[5] produces this a[5] = ] +

@yojimbo2000 thanks for the extra details

@yojimbo2000 @jmv38 the += cases you described should be fixed in the next update

thank you!

Awesome!!

Have downloaded and I think that music restarting bug has gone, ace!!

Have left 5 star review again on Apple Store. Let me know if it hasn’t come through.

Thank you!

MajorMorgan
8bitmagicgames

BUG REPORT: Another bug?
i was trying to make the star wars intro sequence (3d text on a starry background) but the camera wouldnt work. After quite some time i found out that the stars sprite is drawn after the blabla, masking it, while i i draw it before. Can you check if this is a bug or did i miss something?
In the code below i’ve changed the star sprite size to show the text behind.


--# Blabla
Blabla = class()

function Blabla:init()
    self.txt = "War! The Republic is crumbling under attacks by the ruthless Sith Lord, Count Dooku. There are heroes on both sides. Evil is everywhere. In a stunning move, the fiendish droid leader, General Grievous, has swept into the Republic capital and kidnapped Chancellor Palpatine, leader of the Galactic Senate. As the Separatist Droid Army attempts to flee the besieged capital with their valuable hostage, two Jedi Knights lead a desperate mission to rescue the captive Chancellor...."
    self.x = 0
    self.y = -300
    self.z = 300
end

function Blabla:draw()
    camera(self.x, self.y, self.z, 0,0,0, 0,1,0)
    perspective(90)
    textMode(CENTER)
    textWrapWidth(WIDTH/2)
    textAlign(CENTER)
    fontSize(30)
    fill(255, 229, 0, 255)
    text(self.txt, 0,0)
end

function Blabla:touched(t)
    self.x = self.x + t.deltaX 
    self.y = self.y + t.deltaY
    print(self.x,self.y)
end

--# Stars
Stars = class()

function Stars:init()
    self.img = image(WIDTH/2,HEIGHT/2)
    setContext(self.img)
    background(0)
    for i=1,200 do
        local x = math.random(WIDTH)
        local y = math.random(HEIGHT)
        self.img:set(x,y,color(250))
    end
    setContext()
end

function Stars:draw()
    spriteMode(CORNER)
    sprite(self.img,0,0)
end

function Stars:touched(touch)
    -- Codea does not automatically call this method
end

--# Main
-- star wars 1

function setup()
   -- displayMode(OVERLAY)
    stars = Stars()
    blabla = Blabla()
end

function draw()
    background(40, 40, 50)
    --stars:draw() -- uncomment this line to see the bug: it will draw AFTER blabla instead of BEFORE
    blabla:draw()
end

function touched(t)
    blabla:touched(t)
end

@Jmv38 interesting issue. I think what’s happening is your stars sprite is rendering into the Z-buffer, and then the blabla object is testing as “behind” the sprite because it’s further away from the camera (-300) when rendered.