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

115 37128
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

Yeah you are a genius! How did you know the script :P?
Btw, MERRY CRISTMAS!

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

Heh, thanks I've made a couple simple flash games which use this kinda script. Merry Christmas to you to!

plasmafish
offline
plasmafish
252 posts
Nomad

Using _root. will allow your code to work but learning to use _root. for everything is HIGHLY frowned upon. Relative referencing is the practiced method but _root. will work for one movie.

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

What else is there besides this. and _root. ?

plasmafish
offline
plasmafish
252 posts
Nomad

_parent, _global, _level0

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

Hello, i need help again :P. But this time it aint so big.

You know you said you could make the things invisible and visible, but how do you make like; i want to make a shop where i can buy weapons but there is a problem... The shop is on another layer so how do i enable the visible things when scripting in another layer, :S?

Axel
offline
Axel
475 posts
Nomad

is it visible = false?

maybe?

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

You could use _root.shop._visible = true; or something along those lines. If you can't use script in a layer to do things to objects in other layers for some reason, you could export a movieclip that always exists (like your main character) for actionscript, and make a class for it. You could put some of the script in this instead of in a frame or on a movieclip.

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

I mean in another Layer and another frame :P
I need it to attach from 657 to frame 52 in another layer by clicking a button ^^

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

On the button put:

on(release)
{
_root.gotoAndStop(52);
}

I think that's what you're asking.

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

Nono that is not what i mean :P, i know that simple script. ^^
I mean i click a button and then the weapon goes visible on another frame , like you buy a weapon and when you bought it you have to click continue so don't go right to the mission when "buy" button is clicked. What i mean is that the "glock" is going visible on frame 51 when clicking buy button on frame 657 ^^

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

i will give you the code:

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

it does not give any errors but it doesn't work because "mcMain" is on another frame.

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

if the frame with mcMain is part of the level, can't you just make the gun visible, then gotoAndPlay the frame with mcMain?

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

because i don't want it to be like if you click the buy button you go to the nezt frame and start to play, i want it to be like the shop of: http://armorgames.com/play/3454/penguinz

but just the shop(not the graphics) but the script ^^

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

Then when you press the buy button can't you use glockAvailable = true; then, when you leave the shop, go to the frame with mcMain?

Showing 16-30 of 115