Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
pics disappears — Gideros Forum

pics disappears

JackoJacko Member
edited July 2014 in General questions
why after restarting my project, all my pics disappears?

Comments

  • altaialtai Member
    edited July 2014
    Unfortunately player can't detect this error yet. I think, Zero division error(NaN, inf,-1.#IND) causes this error.
    You should check your code in onEnterFrame function. Notice If you give a Nan force value to applyFoce, All sprites and shapes disappear from the stage/scene. @atilim and @ar2rsawseen can you fix this debug issue? If I'm wrong, please correct me :)
    function game:onEnterFrame(event)
    	-- do the low-pass filtering
    	fdt = event.deltaTime * lowfilter + fdt * (1 - lowfilter)
    	world:step(fdt, 9, 3)
     
    	for body,sprite in pairs(actors1) do
    		if body.type == "ball" then
    			if body then
    				local bx, by = body:getPosition()
    				sprite:setPosition(bx, by)
    				sprite:setRotation(body:getAngle() * 180 / math.pi)
    			end
    		end
    	end
     
        if self.ball1 then
    		ballx, bally	= self.ball1.body:getPosition()
     
    		-- check your force calculation!
    		--...
    		--local force = accel*mass
    		--local forcex = velx/curVel * force -- Sometimes calculation may be overlooked with zero value
    		--...
     
    		forcex = 1/0 -- it causes "divide by zero error"
    		forcey = 3
    		self.ball1.body:applyForce(forcex, forcey, ballx, bally) --> All sprites and shapes disappear from the stage/scene
    	end
    end
Sign In or Register to comment.