For some reason, i cannot return the object transmitted in the transition.to
The following function is generating a bullet and once it generated i want it to be removed after completion of the transition action. I got the following error
[blockcode]
Runtime error
/Development/starwar/library.lua:44: attempt to call method ‘removeSelf’ (a nil value)
stack traceback:
[C]: in function ‘removeSelf’
/Development/starwar/library.lua:44: in function
(tail call): ?
?: in function <?:866>
?: in function <?:214>
[/blockcode]
instantiate Bulle Function:-
I take it that there could be several bullets active at the same time. Read up the transition.to description. Use the target param for the oncomplete handler, instead of using bullet directly. Bullet will be nil after the first time you removed something. [import]uid: 5712 topic_id: 3997 reply_id: 12158[/import]
Thanks MikeHart! This is exactly my problem. Forget about the transition.to duplicate, i already fixed that. My problem is how to solve the problem im facing when i need to generate several bullets and once every bullet reaches the y=28 i want to remove only that particular bullet. As you know, my app will be sending random bullets based on “onTouch” event listener. So i just need to know how to fix my code to remove only the bullet arrived to that point.
Thanks my friend for your co-operation.
I love you guys [import]uid: 11038 topic_id: 3997 reply_id: 12160[/import]
Sorry forgot to pass the error:-
[blockcode]
Runtime error
/Development/starwar/main.lua:200: attempt to call method ‘removeSelf’ (a nil value)
stack traceback:
[C]: in function ‘removeSelf’
/Development/starwar/main.lua:200: in function
(tail call): ?
?: in function <?:866>
?: in function <?:214>
namebullet
Runtime error
/Development/starwar/main.lua:200: attempt to call method ‘removeSelf’ (a nil value)
stack traceback:
[C]: in function ‘removeSelf’
/Development/starwar/main.lua:200: in function
(tail call): ?
?: in function <?:866>
?: in function <?:214>
You didn’t define your removebullet function until *after* you call it. This won’t work, unless you add this at the top of your file
[lua]local removeBullet[/lua]
Before your instantiatebullet function at least. Or simpler just to move the removebullet function above the instantiatebullet function in the first place [import]uid: 6645 topic_id: 3997 reply_id: 12188[/import]
Really!! I didn’t expect this step. i’ll try this and will let you know. Thanks
jmp909, please one more thing! my simulator was working perfectly when ever i open a project using the corona terminal, the simulator (iphone) opens maximized by default. For some reasons, now it opens minimized and i need to click on command+= (Zoom in option from the main menu) to maximize the simulator (iphone). This however, makes me do this every time whenever i click on command+r (File> Relaunch) .