ForumsProgramming Forum[Need Help] Attaching movie clips (my weapons).. etc

115 37129
Voidcrystal
offline
Voidcrystal
138 posts
Nomad

Hello!

1.I need help with some scripting that i can't really do, i need to attach my weapon to the character, i have made the weapon and i can rotate it and here is the script:

onClipEvent (enterFrame) {

_rotation = ((Math.atan2(_root._ymouse-_y,_root._xmouse-_x)/(Math.PI/180))+90)
}

2.I would also like to make the buttons 1, 2, 3, 4, 5 as weapon buttons, as an example: 1: glock, 2: uzi, 3: mp5, 4: Sniper, 5. bazooka. But i don't want the people to have them all at the beginning, i want them to buy them for kills at the end of the level.

3. How do i make my enemies have more hp or less hp? And how to make the the weapons shoot faster and slower, more dmg and lesser dmg.

I know this is kinda much but this is all the things i don't really understand atm, thanks for reading and if you can help, please do.

  • 115 Replies
Voidcrystal
offline
Voidcrystal
138 posts
Nomad

Error 2: mcMain.as: Line 12: There is no property with the name 'glock'.
this.glock._visible = true;

:P

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

Did you give the glock that's part of mcMain the instance name glock?

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

yep

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

try _root.mcMain.glock._visible = true; instead, I'm not sure why that didn't work, but this should

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

mcMain.as: Line 12: There is no property with the name 'glock'.
this.glock._visible = true;

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

oops missclick

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

no error now but the weapon is still there, withot the "49" click (number 1)

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

add _root.mcMain.glock._visible = false; in the onLoad function

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

No errors now but the Key does not work

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

Did you put _root.mcMain.glockAvailable = true; when you press buy glock?

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

class mcMain extends MovieClip
{
var glockAvailable;
function onLoad()
{
_root.mcMain.glock._visible = true;

glockAvailable = false;
}
function onEnterFrame()
{
if(Key.isDown(49) && glockAvailable == true)
{
_root.mcMain.glock._visible = true;
}
}
}

and button

on (release)
{
_root.mcMain.hair2Available = true;
}

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

on (release)
{
_root.mcMain.glockAvailable = true;
}

i ment :P

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

I don't see any errors, are you sure you pressed the right "buy" button when you tested it?

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

Wait, I see it now, make glock invisible in the onLoad function, not visible

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

yeah i fixed glock invi but still same problem.. :S

i can send the script again:

Butt:

on (release)
{
_root.mcMain.hair2Available = true;
}

McMain.as:

class mcMain extends MovieClip
{
var hair2Available;
function onLoad()
{
_root.mcMain.hair2._visible = false;

hair2Available = false;
}
function onEnterFrame()
{
if(Key.isDown(49) && hair2Available == true)
{
_root.mcMain.hair2._visible = true;
}
}
}

Showing 61-75 of 115