SumYungGai
35 posts
|
Topic: Programming /
Sound trouble
I’m having a bit of trouble with some sounds I’m trying to play. I have this code in my frame.
musicvar = 1
loopy = 1
Music1 = new Sound(this);
Music1.attachSound("Sound1");
Music2 = new Sound(this);
Music2.attachSound("Sound2");
onEnterFrame = function () {
if(musicvar == 1 and loopy == 1){
Music1.start(0, Infinity)
Music2.stop()
loopy = 0
}
if(musicvar == 2 and loopy == 1){
Music2.start(0, Infinity)
Music1.stop()
loopy = 0
}
}
I did link two sounds as Sound1 and Sound2. If I take the stop() functions out it works but play the other sound without stopping the first.
I have two buttons that change the musicvar from 1 to 2 and visa versa, and also when clicked chenge loopy to 1. But, my music doesn’t play. Can anyone help?
|
| |
SumYungGai
35 posts
|
Topic: Programming /
New Game
You need to be able to set the x speed (x += number) going in a poitive direction if moving right, coming from the left side, and set it negitive (x -= number) if going left coming from the right. You will also need a hitTest for the monkey and spear. You need an on(press) event for the clicking procedure, and you need it to add to your score variable. Make sure that you use _root. when nessesary and you know…some other stuff.
|
| |
SumYungGai
35 posts
|
Topic: Programming /
How to make a gun point torwards a mouse in AS2 help please ?
You need to make the bullet’s horizontal speed = Math.cos(angle) and the vertical speed = Math.sin(angle) angle must be in radians
|
| |
SumYungGai
35 posts
|
Topic: Programming /
Win Button Function
Do you mean a button to make you automatically win? Or like a button that appears after the game is done to go to a win screen?
|
| |
SumYungGai
35 posts
|
|
| |
SumYungGai
35 posts
|
Topic: Programming /
How to make a gun point torwards a mouse in AS2 help please ?
Try inserting: var angle = Math.atan2(ymouse, _xmouse)*180 / Math.PI this.rotation = angle That takes the radian mode of the atan2 function and converts it into degrees. EDIT: There’s and underscore before ymouse and another underscore before rotation but textile converted it.
|
| |
SumYungGai
35 posts
|
Topic: Programming /
Slowed rotation towards mouse (solved)
You used Moonkey’s code and rotated your object but it still didn’t work? Hmm, did you rotate the raw object and not just the clip?
|
| |
SumYungGai
35 posts
|
Topic: Programming /
Slowed rotation towards mouse (solved)
Double click your movie clip and turn it 90 degrees, it should be facing right at first. That should help.
|
| |
SumYungGai
35 posts
|
Topic: Programming /
How to make a gun point torwards a mouse in AS2 help please ?
You need to use the Math.atan2(y, x) function for the rotation of the gun. Math.cos(angle) should give you your x speed and Math.sin(angle) should give you your y speed. Multiply the cos and sin as needed to get the appropriate bullet speed. The number multiplied by the cos and the number multiplied by the sin should be the same.
|
| |
SumYungGai
35 posts
|
Topic: Programming /
HitTest -points
Something like in the Monkey:
onClipEvent(load){
var maxHp = 250
var HpLeft = 250
}
onClipEvent(enterFrame){
root.HpBar.xscale = (HpLeft / maxHp) * 100
_root.scoretxt.text = "Score = " + _root.score
if (_root.spear.hitTest(this)){
HpLeft -= 25
}
if(root.HpBar.xscale < 0){
_root.HpBar.xscale = 0
}
}
in your spear:
onClipEvent(load){
xspeed = 10
yspeed = 0
}
onClipEvent(enterFrame){
_x -= xspeed
_y += yspeed
}
on(press){
xspeed = 0
yspeed = 10
_root.score += 25
}
And in your frame
stop();
score = 0
You might need to mess with it depending on what your game looks like, but that basically should work. Some underscores were left out cuz of textile…
|
| |
SumYungGai
35 posts
|
Topic: Programming /
I did it, but...
Pressing control + enter should test your movie. Also, in the Kong menu, there is Developers —> Upload Game. In there should be directions on how to upload your swf. file (the actual game file).
|
| |
SumYungGai
35 posts
|
Topic: Programming /
Slowed rotation towards mouse (solved)
I’d have to say, put a variable for the tank’s rotation, and a variable for the actual angle. something like
tankrot = turret._rotation
angle = Math.atan2(dy, dx)
if (tankrot !== angle){
if(angle > tankrot){
tankrot ++
}else{
tankrot --
}
}
With the other stuff a’course, but I think that should work.
|
| |
SumYungGai
35 posts
|
Topic: Programming /
2 Quick Questions
2. In your movie clip, for expoential growth/shrinkage put this.yscale = (1/ymouse) For the x code just put x’s in for the y’s. For linear this.yscale = (100-ymouse) You might want to put _ymouse/4 or something, because after 100 the box would disappear.
|
| |
SumYungGai
35 posts
|
Topic: Programming /
Need a flash lesson
It says - Sticky: [FAQ] Making Games. READ FIRST! Also I beleive Emanuele’s site is a good tutorial, just search Emanuel Feronato Flash Game Creation Tutorial Part 1 you should get a good tutorial from that site.
|
| |
SumYungGai
35 posts
|
Topic: Programming /
How to make a world
Instead of moving your guy up, inverse the code, making the stage go down.
|
| |
SumYungGai
35 posts
|
Topic: Games /
Runescape: Good or Bad?
Ya, noob got annoying after a while; people on Runescape…most of them I believe…are just idiotic and immature. But, I had fun playing it and it doesn’t deserve all this negitivity…I quit because it wouldn’t let me give my crap stuff to my friends…and also after lvl 60 or 70…HappyYay is right…it got boring as Hell just farming all day, but you couldn’t make a new file because people would heckle you…so W/E
|
| |
SumYungGai
35 posts
|
Topic: Games /
Top Ten easy badges
I would just say play games that you like…if you get the badges then woohoo…but…try out the dungeon defender games, they’re easy
|
| |
SumYungGai
35 posts
|
Topic: Games /
the epic war fan club yey
If it had a faster moving time on it I’d say 5/5, but other than that I love games that I can just PWN the crap out of, they makes me feels good.
|
| |
SumYungGai
35 posts
|
Topic: Programming /
Another Dum Mistake Probly
Nvm, it works now, thex Deep…btw I had to move my variables above the onEnterFrame function to make it update the variable.
|
| |
SumYungGai
35 posts
|
Topic: Programming /
Another Dum Mistake Probly
I cant figger out how to put swf files in posts….
|
| |
SumYungGai
35 posts
|
Topic: Programming /
AS Chart
gotoAndPlay(number) [plays a certain frame on an object] gotoAndStop(number) [self explanitory] Key.isDown(Key.Space) [checks to see if a certain key is down, e.g. Space] if(a statement here){
a then clause here} [An if-then statement, checks to see if the above is true, then carries out the command] some other ones…too lazy right now
|
| |
SumYungGai
35 posts
|
Topic: Programming /
Another Dum Mistake Probly
Oh well ill try a lil more to fix it and hopefully i can get it to work
|
| |
SumYungGai
35 posts
|
Topic: Programming /
Another Dum Mistake Probly
Ya i fixed that…still didnt work =/ srry and for some wierd reason I had to fix all of ur “s because they were…a diffent kind not allowed in AS er somethin
|
| |
SumYungGai
35 posts
|
Topic: Programming /
Another Dum Mistake Probly
LOL! still doesn’t work, ever after declaring my variable is a number…
|
| |
SumYungGai
35 posts
|
Topic: Programming /
Another Dum Mistake Probly
If I can’t understand what I did wrong…if never find it at all…I won’t learn either so that does me no good.
|