This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#26 2008-08-06 02:39:01

theshapeshifterage
Scratcher
Registered: 2008-08-04
Posts: 100+

Re: coding in flash actionscript 2.0 for beginners

wow i am glad i  only skimmed through it

Offline

 

#27 2008-08-06 02:44:38

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

theshapeshifterage wrote:

wow i am glad i  only skimmed through it

Why? It is actually quite simple. Though I'm still a noob at Flash XD hopefully I will post a link to my first game soon, where you can see it's effectiveness (the this._X= random(500)+!


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#28 2008-08-06 14:30:02

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

It is just better to code more neatly. If your code gets sloppy it will become unmanageable.

Also, check out this site that has fla files of game templates.
http://www.freewebs.com/pyro111/flafiles.htm


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#29 2008-08-06 14:32:49

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

I have a question: I'm trying to detect the ground (I call it ground) by using these:

    }
    if (this.hitTest(_root.ground)){
        _y-= 2;
    }
    if (this.hitTest(_root.ground) == false){
        _y+=2;
    }

above it is just movement. How come it isn't working?


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#30 2008-08-06 14:43:31

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

Bluestribute wrote:

I have a question: I'm trying to detect the ground (I call it ground) by using these:

    }
    if (this.hitTest(_root.ground)){
        _y-= 2;
    }
    if (this.hitTest(_root.ground) == false){
        _y+=2;
    }

above it is just movement. How come it isn't working?

I know exactly what the problem is. A basic hitTest will only hitTest the bounding boxes of the 2 MCs. For a more precise hitTest use the shape flag hitTest which hitTest coordinates.

like this

if (_root.ground.hitTest(_x,_y+(_height/2),true)

This will check for the ground MC at the bottom of the MC that has this script on it.

Also, if you are trying to raise your MC above ground a while loop will do the best job.

while (_root.ground.hitTest(_x,_y+(_height/2),true){
_y--;
}

And check that site with the flas I posted. It has a fla for platformer games.

Last edited by archmage (2008-08-06 14:47:33)


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#31 2008-08-06 14:48:54

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

archmage wrote:

Bluestribute wrote:

I have a question: I'm trying to detect the ground (I call it ground) by using these:

    }
    if (this.hitTest(_root.ground)){
        _y-= 2;
    }
    if (this.hitTest(_root.ground) == false){
        _y+=2;
    }

above it is just movement. How come it isn't working?

I know exactly what the problem is. A basic hitTest will only hitTest the bounding boxes of the 2 MCs. For a more precise hitTest use the shape flag hitTest which hitTest coordinates.

like this

if (_root.ground.hitTest(_x,_y+(_height/2),true)

This will check for the ground MC at the bottom of the MC that has this script on it.

Also, if you are trying to raise your MC above ground a while loop will do the best job.

while (_root.ground.hitTest(_x,_y+(_height/2),true){
_y--;
}
I feel so stupid for not remembering that XD and I put in EXACTlY what you wrote, but couldn't move. So than I made it it's own little thing and got Syntax error?
And check that site with the flas I posted. It has a fla for platformer games. Woops. Forgot to put it outside the quote box

Last edited by Bluestribute (2008-08-06 14:53:16)


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#32 2008-08-06 14:52:48

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

It is kinda working now. And i bookamrked that site. probably would be a good idea to find a platformer


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#33 2008-08-06 14:54:53

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

Ah, silly me. I forgot a close bracket.
(_root.ground.hitTest(_x,_y+(_height/2),true))

It is important to carefully read the errors the debugger gives you. I make mistakes all the time but the debugger is really helpful in fixing them.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#34 2008-08-06 14:58:23

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

archmage wrote:

Ah, silly me. I forgot a close bracket.
(_root.ground.hitTest(_x,_y+(_height/2),true))

It is important to carefully read the errors the debugger gives you. I make mistakes all the time but the debugger is really helpful in fixing them.

I kinda figured you missed those. So I added them XD now the terrain is basically a bumpy hill, where the might not work…


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#35 2008-08-07 11:43:28

Hobbs1100
Scratcher
Registered: 2008-02-16
Posts: 500+

Re: coding in flash actionscript 2.0 for beginners

Cool. This is really helpful! Does Flash 8 have AS3 or AS2? I think it has AC2 though. I've noticed that lots of tutorials just show you the script and it tells you what it makes. Maybe you could make a tutorial that tells you what each thing does. Just the basics though. Like, when to use a certain word in the script, like root. or what order do some words need to be in. That would really help!

Offline

 

#36 2008-08-07 11:51:37

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

Hobbs1100 wrote:

Cool. This is really helpful! Does Flash 8 have AS3 or AS2? I think it has AC2 though. I've noticed that lots of tutorials just show you the script and it tells you what it makes. Maybe you could make a tutorial that tells you what each thing does. Just the basics though. Like, when to use a certain word in the script, like root. or what order do some words need to be in. That would really help!

Only flash CS3 has AS3. And in this mini tutorial I did explain _root and all the code I used.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#37 2008-08-07 13:09:30

Bobby500
Scratcher
Registered: 2008-04-19
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

How come most flash games have better graphics and smother animation cycles than scratch does?

Offline

 

#38 2008-08-07 13:44:07

Hobbs1100
Scratcher
Registered: 2008-02-16
Posts: 500+

Re: coding in flash actionscript 2.0 for beginners

Because Flash is a professional program used by, well, pros. Lots of cartoons on T.V. these days are made in Flash. You know Foster's Home For Imaginary Friends? That was made in flash. If not, something like Flash.

Offline

 

#39 2008-08-07 13:45:37

Bobby500
Scratcher
Registered: 2008-04-19
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

Wow! Diddent no that!

Offline

 

#40 2008-08-07 14:14:30

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

Bobby500 wrote:

How come most flash games have better graphics and smother animation cycles than scratch does?

Scratch has a very poor drawing tool. Flash has a very good drawing tool with loads of features. For the price of flash the drawing tool better be good.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#41 2008-08-07 14:17:01

Hobbs1100
Scratcher
Registered: 2008-02-16
Posts: 500+

Re: coding in flash actionscript 2.0 for beginners

Hey, Archmage, when did you start learning Flash?

Offline

 

#42 2008-08-07 14:20:49

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

Hobbs1100 wrote:

Hey, Archmage, when did you start learning Flash?

Ummm, 3 or so years ago.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#43 2008-08-07 16:26:08

Hobbs1100
Scratcher
Registered: 2008-02-16
Posts: 500+

Re: coding in flash actionscript 2.0 for beginners

I meant around what age? I'm 12, so would that be a good time to start?

Offline

 

#44 2008-08-07 16:29:32

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

Hobbs1100 wrote:

I meant around what age? I'm 12, so would that be a good time to start?

I'm13. After 1 day, I'm making Bomb Squad. In fact, all I need is to know how to make the buttons (which are movie clips) change like in my Scratch version


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#45 2008-08-07 16:59:27

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: coding in flash actionscript 2.0 for beginners

archmage wrote:

Cyclone103 wrote:

Awesome tutorial archmage! This is especially useful for me since I am getting flash some time this week or next week. Thanks!

Remember that this is just for AS2. The newest version of flash features AS3 which is way more efficient. I reccomend trying out both languages though.

That would explain why stuff was not there u described. I was trying 3. Brb, after I try two....


All your base are belong to us

Offline

 

#46 2008-08-07 17:00:04

Hobbs1100
Scratcher
Registered: 2008-02-16
Posts: 500+

Re: coding in flash actionscript 2.0 for beginners

Cool. I've always wanted to make a first-person shooter. Maybe I could make money with flash and use the money for a fps maker!

Offline

 

#47 2008-08-07 17:00:29

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: coding in flash actionscript 2.0 for beginners

Bluestribute wrote:

Hobbs1100 wrote:

I meant around what age? I'm 12, so would that be a good time to start?

I'm13. After 1 day, I'm making Bomb Squad. In fact, all I need is to know how to make the buttons (which are movie clips) change like in my Scratch version

14 lol! Sorry to be off topic  tongue


All your base are belong to us

Offline

 

#48 2008-08-07 17:09:47

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: coding in flash actionscript 2.0 for beginners

I got a GREAT bundle, it has dreamweaver, fireworks, and contributor, and cost me less then flash with a student discount. Final tab: $218.36. It was worth it. Now, I am a bit confused. Where exactly do you code in Actionscript? I am in 2.0, but it looks to be the exact same as 3.0. Oh. Jeez. I feel dumb now lol! I just found the button. Um. Nevermind. Lemme test it out!


All your base are belong to us

Offline

 

#49 2008-08-07 17:32:10

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: coding in flash actionscript 2.0 for beginners

Ok, problem. The text box is not displaying any text. What do I do? I set it to dynamic, and it is supposed to display the variable.


All your base are belong to us

Offline

 

#50 2008-08-07 17:37:23

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: coding in flash actionscript 2.0 for beginners

Cyclone103 wrote:

Ok, problem. The text box is not displaying any text. What do I do? I set it to dynamic, and it is supposed to display the variable.

Did you do

_root.var (replace with your variable)


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

Board footer