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

115 37131
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 but i don't wanna leave the shop when pressing the buy weapon

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

So when you buy the weapon, make the variable for if it's available true, but not leave the shop. When you leave the shop then go to the frame with mcMain

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

i don't really understand, send exact script please :P

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

ok, on the buy button for the glock, put:
on(release)
{
glockAvailable = true;
}

and on the leave shop button put:
on(release)
{
gotoAndStop(52) //or gotoAndPlay(52) depending on how your game works.
}

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

Yeah, but what about the mcMain? maybe something like this or?

onClipEvent (load) {
var glockAvailable;
glockAvailable = true;

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

Isn't your mcMain on frame 52? so shouldn't it already be visible?

if not you can include _root.mcMain._visible = true; when you goto fram 52

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

in mcMain, can't i make something like:

_root.mcMain.glock._visible = false;
glockAvailable = false
if(glockAvailable == true){
}
_root.mcMain.glock._visible = true;

I do not get any Errors but it doesn't work, the glock is visible without clicking the buy button¨

The button:

on (release)
{
var glockAvaible;
glockAvailable = true;

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

the problem with that code is htat you're setting glockAvailable to false right before checking if it is true, so it will never make the gun visible

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

send fixed script please

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

in the onload make glockAvailable false, and take that part out of the enterFrame code, then it should work

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

hmm`? :P

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

Tell me exactly how to do like:

on mcMain:

(script)

on Button:

(script)

on mcMain's Frame:

(script) ^^

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

Oh, sorry. This might not be the easiest way to do it, but I'm more used to making most of the code this way: Export mcMain for actionscript, and put htis code in the class:

class mcMain extends MovieClip
{
var glockAvailable;
function onLoad()
{
glockAvailable = false;
}
function onEnterFrame()
{
if(Key.isDown(49) && glockAvailable == true)
{
this.glock._visible = true;
}
}
}
}

this is just the basic part and only works for the glock.

On the buy button, make it:

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

You should now be able to switch to the glock by pressing one IF you have bought it in the shop.

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

this does not change the other script then ?

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

Just delete the part about glockAvailable and stuff related to it in the frames

Showing 31-45 of 115