Constant cheking

How can I do a function that still in a constant checking, if some variable chance out this function, this variable will change in this function too

anyone know a way? :S [import]uid: 23063 topic_id: 9964 reply_id: 309964[/import]

@DHennrich,
ich kann nicht verstanden. Are you trying to have functionality like Objective-C where you can monitor for property changes? Like the addObserver?

I have created a custom control notifier that one can use for custom notifications, you can use the same even for variable changes, if you so wish.

http://howto.oz-apps.com/2011/05/create-notification-center-like-in.html

To use,

[lua]local notif = require(“Notification”)
local notify = notif.new()

notify.addHook(“myNameVar”, onMyNameVarChange)[/lua]
wherever you change the variable, you can invoke the function by calling
[lua]notify.Notify(“myNameVar”)[/lua]

I hope that helps resolve your issue? You can buy this code if you so wish to use in your own apps.

?:slight_smile: [import]uid: 3826 topic_id: 9964 reply_id: 36403[/import]

No no, i dont want to be notificated about this function, i want to change a variable while playing the game… but i have tryied to change a size and image of collision body of my object while playing… its something like that:

local cauldronBigger = true  
local cauldronSmaller = false  
  
 if cauldronBigger == true and cauldronSmaller == false then  
  
 cauldron = display.newImageRect( "cauldron.png", 360, 86 )  
 cauldron.x = 260; cauldron.y = 280  
  
end  
  
if cauldronSmaller == false and cauldronBigger == true then  
  
 local cauldronShape = { -400, -1, 400, -1, 500,1, -500,1 }  
 physics.addBody( cauldron, "static", { density = 1.0, bounce = 0, friction = 38.5, shape = cauldronShape }  
  
end  
  
and in a collion i put this in code:  
  
cauldronBigger = false  
cauldronSmaller = true  
  

[import]uid: 23063 topic_id: 9964 reply_id: 36410[/import]

I don’t think you are going about this the wrong way - I think you are using the wrong method to switch on the different collision bounding boxes of your cauldron.

If you create two separate objects, one big one small, and use the isBodyActive property to switch the correct one on, you’ll see what you want.

http://developer.anscamobile.com/reference/index/bodyisbodyactive

The only problem is that you may not be able to turn that on and off within a collision event listener function, in which case you should set a 1 millisecond timer to fire a different function and set the isBodyActive property there. [import]uid: 8271 topic_id: 9964 reply_id: 36413[/import]

Can you make me a sample of this? in doc is only

myBody.isBodyActive = true local state = myBody.isBodyActive
if you could say me where put this ^^ [import]uid: 23063 topic_id: 9964 reply_id: 36459[/import]