Ask a Question related to Macromedia Director 3D, Design and Development.
-
Mazuho #1
Parent script calling another parent script
For the enemy in my game I let one parent script check if the distance between
the player and the enemy is low enough. When it is, it calls another parent
script which should send a bullet in the direction of the player. My problem is
that the bullet (created entirely within the called parent script) exists for
only one frame before disappearing. My guess is that the called parent script
gets deleted for some unknown reason before it can delete itself.
What should I look out for, anyone experienced the same?
Here's the code from the calling parent script:
on aisend me
if distancebet < 50 then
me.aishoot()
end if
end
on AIshoot me
shoottime = shoottime + 1
if shoottime > 200 then --Can I shoot?
vAIB = script("AIbullet").new()
(the actorlist).append(vAIB)
shoottime = 0
end if
end
And here's the entire AI bullet parent script:
global KulaRB, w, havok, vecc, kcount, dronetur
property hke_kulan, kulan
on new me
-- Kulan
kcount = kcount + 15
kulan = w.newmodel("bullet"&string(kcount), kulaRB)
put kulan
kulan.addmodifier(#meshdeform)
kulaNamnn = "blubb"&string(kcount)
hke_kulan = havok.makemovablerigidbody(kulan.name, 500, true, #sphere)
--Kulans shader
kulan.shader.useDiffuseWithTexture = 1
kulan.shader.emissive = rgb(0,0,255)
kulan.shader.diffuse = rgb(0,0,255)
kulan.shader.blendconstant = 100
kulan.debug = 1
--##
--Send the bullet
kulan.worldposition = dronetur.worldposition
havok.registerinterest(hke_kulan.name, #all, 0, 0, #shoot, me)
havok.registerstepcallback(#shoot, me)
havok.registerstepcallback(#trajectory, me)
return me
end
on trajectory me
hke_kulan.applyforce(vecc)
end
--End of code
BTW, "kulan" means "the bullet" in Swedish. I'm too lazy to change it =P
Mazuho Guest
-
Referencing (calling) states in the parent component
Hello All, I think this should be pretty easy to do but I am having a hell of a time doing it. I have a parent component, main.mxml, and a... -
Calling a function on the component's parent.
How would you go about sending an event in the seeting of a popupWindow? I open a popup window child to parent document. I would like to run an... -
Contextual Menu Parent Scripts : update and init script available
Contextual Menu Parent Scripts The code in the Chrome Lib has been fixed and commented. I added an init sample movie script. Two arrow bitmaps... -
Parent script - instance help
Hi I have a movie with several parentscripts. the offspring of these parent scripts have dynamically allocated names. At a certain point, I want to... -
#24735 [NEW]: call_user_func on parent method does not use parent private property
From: tater at potatoe dot com Operating system: OS X 10.2 PHP version: 5CVS-2003-07-21 (dev) PHP Bug Type: Zend Engine 2... -
ensamblador #2
Re: Parent script calling another parent script
Are you sure the script gets deleted?, how?
Did you try:
on stepframe me
put "i am alive!"
end stepframe
?
or
put the actorlist
--in the message window.
?
hope it works...
ensamblador Guest



Reply With Quote

