Quick AS2 help

A place for tutorials on how to get the most out of Flash

Quick AS2 help

Postby Digfree » Sat Apr 13, 2013 6:51 am

Hey can anyone give me some pointers why this isn't working? I want a piece of code that when it reads it reduces the score by -10 This is what I got so far (not sure why but can't upload the fla).

Also the 2nd part makes it so when it hits 0 it stops there.

If you could, as well as the first part, any tips on how to make a random range selection wold help too, as in you loose 8-14 health per hit instead to add a bit of randomness.
Thanks mates :D

*P.S. Looks like shit I know, but just trying to get code working before I art it up :3
Attachments
help.jpg
ImageImageImageImage
User avatar
Digfree
Moderator
 
Joined: Fri Nov 26, 2010 12:04 am

Re: Quick AS2 help

Postby Ivan-Aedler » Sat Apr 13, 2013 7:16 am

Hey, how are you?
Just send me the FLA (compressed as RAR), and I can look at it ;)

DigDree Wrote:any tips on how to make a random range selection wold help too, as in you loose 8-14 health per hit instead to add a bit of randomness.

But the RANDOM function can also be used for range.

Just do this!
Code: Select All Code
enemyRange=8+random(7); //8 is a fixed number. Random starts with 0 until 6. So, the possible values: 8,9,10,11,12,13,14.


You can also create a more complex and 'even more random' code, using random numbers in a equation with more random numbers!

Code: Select All Code
//random +random = even more random!
equationA=5+random(10)/1+random(3);


I'm now analysing your code ;)
Last edited by Ivan-Aedler on Sat Apr 13, 2013 7:21 am, edited 1 time in total.
User avatar
Ivan-Aedler
 
Joined: Fri Jun 03, 2011 6:34 am
Location: GMT -3

Re: Quick AS2 help

Postby Digfree » Sat Apr 13, 2013 7:21 am

Thanks for the fast reply :3 sent you the file.

Also, is the code above AS2 or 3?
ImageImageImageImage
User avatar
Digfree
Moderator
 
Joined: Fri Nov 26, 2010 12:04 am

Re: Quick AS2 help

Postby Ivan-Aedler » Sat Apr 13, 2013 7:22 am

Digfree Wrote:Also, is the code above AS2 or 3?

As2. ;)
User avatar
Ivan-Aedler
 
Joined: Fri Jun 03, 2011 6:34 am
Location: GMT -3

Re: Quick AS2 help

Postby Digfree » Sat Apr 13, 2013 7:40 am

awesome,

Did you get my file via pm btw?
User avatar
Digfree
Moderator
 
Joined: Fri Nov 26, 2010 12:04 am

Re: Quick AS2 help

Postby Ivan-Aedler » Sat Apr 13, 2013 8:12 am

Digfree Wrote:awesome, Did you get my file via pm btw?

Yes! Sorry about the delay.
The problem was an interesting one!
The font you used (Courier New) was not embedded!
So the system was trying to find '90', without success.

I added the 'range random' for you too. Please check it.
Sent via PM too.

Click to Play
(Javascript Required)

firstrpg CS5.swf [ 313.25 KiB | Viewed 1333 times ]

User avatar
Ivan-Aedler
 
Joined: Fri Jun 03, 2011 6:34 am
Location: GMT -3

Re: Quick AS2 help

Postby Digfree » Sat Apr 13, 2013 5:54 pm

Thanks a bunch, the new version works wonderfully and you were kind enough to explain what I did wrong at every point even. This is the first time I am using AS2 beyond stop and gotoAndPlay. So I didn't know any of this, a really bad tutorial got me that far but it appears I picked a really shitty one.

Let me know if you ever need any art from me, I owe you one mate, but i'll post what I got so far after I get a bit farther along in the rpg. :3
ImageImageImageImage
User avatar
Digfree
Moderator
 
Joined: Fri Nov 26, 2010 12:04 am

Re: Quick AS2 help

Postby Ivan-Aedler » Sat Apr 13, 2013 6:11 pm

Digfree Wrote:Thanks a bunch, the new version works wonderfully and you were kind enough to explain what I did wrong at every point even. This is the first time I am using AS2 beyond stop and gotoAndPlay. So I didn't know any of this, a really bad tutorial got me that far but it appears I picked a really shitty one.

Wow, great! You will see AS2 is still used because we can do many things others do with AS3, and the game development is faster.
Of course, there are things only in AS3 like the 'currentLabel' function (who checks if your current frame is in a given label), the possibility to set different FPS in each Movie Clip (instead of a fixed FPS in the entire project), and more third party functions like MIDI support! Also, games which use tons of movie clips (say, a space area with 1000 meteors), will be up to 10x faster in performance than AS2.

Other than that (in 95% of platformer/isometric games here on LOK), AS2 can suffit well, because the less time to develop, the better, and our games dont have, say, 40 songs, just 2,3, sometimes less than 10. And we dont need 1000 virgins running naked in the screen at the same time :P

Digfree Wrote:Let me know if you ever need any art from me, I owe you one mate, but i'll post what I got so far after I get a bit farther along in the rpg. :3

I'll be eager to see your RPG project.
As for MIM PUT, you know you're part of the round table ;)I'm proud of seeing you there! As for new art, I have 'only' 80 character so far (lol), so, really, the needs are really low. By the way, did you see the sex scenes of your Wrench Mole? I've put in the game. (levels 1-7, 2-7 and 3-7) ;)
Hmm, there is an enemy I need in the game , mostly in the grey castles: Bom-Bom.

Spoiler (click to show/hide):

Image


He uses to be a bit angry :D
See you ;)
User avatar
Ivan-Aedler
 
Joined: Fri Jun 03, 2011 6:34 am
Location: GMT -3

Re: Quick AS2 help

Postby Digfree » Sat Apr 13, 2013 7:24 pm

Ivan-Aedler Wrote: And we dont need 1000 virgins running naked in the screen at the same time :P


Why Not lol?


THis is what I got so far now btw. Thanks for the help so far, will need more advise soon though. Like how to make it so I can't click heal when out of mana. But thats for later
Attachments
Click to Play
(Javascript Required)

firstrpg CS4.swf [ 648.51 KiB | Viewed 1298 times ]

User avatar
Digfree
Moderator
 
Joined: Fri Nov 26, 2010 12:04 am


Return to Tutorials



Who is online

Users browsing this forum: No registered users