Game Development in AS3 Part 1 - Setting up an AS file

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 พ.ย. 2024

ความคิดเห็น • 69

  • @lol960
    @lol960 10 ปีที่แล้ว

    I've already used these tutorials to make a game but I'm coming back to review what I learned. That's how good these are.

  • @viniciusoh
    @viniciusoh 13 ปีที่แล้ว

    Great video! Very usefull and you teach very well.
    Started using flash and AS right before watch the video, and now I feel like I can do anything xD
    Thanks!

  • @rainier1486
    @rainier1486 10 ปีที่แล้ว

    awesome. it is easy to understand. very helpful.

  • @PointClickWin
    @PointClickWin  13 ปีที่แล้ว

    @Djentard You don't have to be working in Flash to make use of a lot of this stuff. The only downside of working in Flex is that you lose the timeline - you can import graphics from outside though, yes. You could go look up Embed in as3 as there are plenty of tutorials out there on it. You could also look at various engines that help with it all - like Flixel

  • @PointClickWin
    @PointClickWin  12 ปีที่แล้ว

    @larsellars Make sure your Ship.as file is saved in the same folder as your .fla. Also, make sure your library symbol for the ship is export as Ship - right click on it in the library and go to properties or linkage and make sure Class says Ship

  • @rickeyrudey
    @rickeyrudey 11 ปีที่แล้ว +2

    this is great bro .... i learn a lot of new concepts from watching ur vids .... would u by chance have any videos demonstrating hittests with irregular objects ?

  • @PointClickWin
    @PointClickWin  13 ปีที่แล้ว

    @vfxenchor Basically, you just remove the event listener for the Event.ENTER_FRAME function in the level. That's why all the classes have an update function instead of their own listeners. So, make a pause button that removes the listener and an unpause button to add it back (or one to toggle!)

  • @PointClickWin
    @PointClickWin  12 ปีที่แล้ว

    @ibrahimahmed1996 Which API? You can import any ActionScript or SWC stuff you like. If you're after specific things you might want to look at frameworks like starling - or Flixel/Flashpunk and so on

  • @PointClickWin
    @PointClickWin  12 ปีที่แล้ว

    You don't necessarily need a document class. Until you specify a document class in the .fla properties, the timeline is the document class, so programs work just fine without any .as files at all

  • @PointClickWin
    @PointClickWin  12 ปีที่แล้ว

    @larsellars Failing that, go to your library, right click on the Ship and go to properties and make sure the 'Base class' says flash.display.Sprite

  • @PointClickWin
    @PointClickWin  13 ปีที่แล้ว

    @bioskok They're just as cos and sin in maths class or on a calculator. I'll try to explain them in a bit more detail in future!

  • @PointClickWin
    @PointClickWin  13 ปีที่แล้ว

    @TheAdsClan Afraid not, I haven't saved the code video by video but I'll probably upload the final result when it's all done

  • @MisterBr0wn
    @MisterBr0wn 13 ปีที่แล้ว

    Love your videos!

  • @PointClickWin
    @PointClickWin  12 ปีที่แล้ว

    :) I'm glad you like it! Personally, I prefer the newer stuff on my site - a lot of this series makes me cringe ;)

  • @PointClickWin
    @PointClickWin  12 ปีที่แล้ว

    You'll have to simulate gravity, yes. I don't think I've directly covered that in this series but there are plenty of bouncing tutorials out there

  • @PointClickWin
    @PointClickWin  13 ปีที่แล้ว

    You don't have to be working in Flash to make use of a lot of this stuff. The only downside of working in Flex is that you lose the timeline - you can import graphics from outside though, yes. You could go look up Embed in as3 as there are plenty of tutorials out there on it. You could also look at various engines that help with it all - like Flixel

  • @wanderfilho
    @wanderfilho 12 ปีที่แล้ว

    First of all, thanks for the tutorial!
    I need some help here... when a select my ship and go to "Modify", "Convert to Symbol", set it's type as Movie Clip, and check the linkage box for "Export for ActionScript", I do change the Base class to "flash.display.Sprite", but when i click on the pencil to "Edit class definition", an error message pop up in my window warning : "A definition for this class could not be in the classpath, so one will be automatically generated in the SWF file upon export

  • @ell366
    @ell366 12 ปีที่แล้ว

    I have the same problem, ships do not move (i put i trace event within the function and this was returned in the output. so why do the ships not move?)

  • @PointClickWin
    @PointClickWin  12 ปีที่แล้ว

    In that case it looks like your ball instance and your ball class have the same name, which causes problems. In general, the class name should start with an upper case letter. So Ball should be your class and you could have an instance called ball, which would work just fine

  • @larsellars
    @larsellars 12 ปีที่แล้ว

    @PointClickWin
    I made a stupid mistake and wrote sprite not Sprite.
    Yet the trouble isn't over the new error is: 1046: Type was not found or was not a compile-time constant: Ship.
    I have used half a hour trying to troubleshoot it my self but i cand't seem to find the mistake.

  • @PointClickWin
    @PointClickWin  12 ปีที่แล้ว

    Are your .as file and your .fla in the same place? I can't imagine why it wouldn't trace if so. Have you got an instance of the ship on the stage? There are a few tutorials on my site that have sample files containing .fla and .as together if you want to try them - the pathfinding or random hills tutorials, for example.

  • @PointClickWin
    @PointClickWin  12 ปีที่แล้ว

    @larsellars Hmm... sounds like you haven't imported flash.display.Sprite in your Ship.as file - check the top few lines and make sure the actual class line says 'extends Sprite' and not 'extends MovieClip'
    Go back a few seconds and double check every line; if you had Flash generate the class for you (by pushing the pencil button) then it will have imported MovieClip instead of Sprite by default

  • @bleachfan44
    @bleachfan44 12 ปีที่แล้ว

    Is there a way to set the rotation in the .as file? I've got a program similar to the one in the video, and my code says:
    ball.rotation = 45
    But I keep getting error: 1119: Access of possibly undefined property rotation through a reference with static type Class.

  • @Djentard
    @Djentard 13 ปีที่แล้ว

    @PointClickWin Question: Do i really need the Adobe Flash Builder to make a full flash game? Because i don't really wanna pay 600-ish € just to test how hard it is to make a flash game. (I know it has a trail but...).
    I use the Adobe Flex SDK that came with FlashDevelop. I guess it's possible to actually draw by code itself in Flex. And importing the sprites and stuff from another program instead of making them in flash builder is possible, right?

  • @theawesome61
    @theawesome61 12 ปีที่แล้ว

    Ship.as, Line 22 1046: Type was not found or was not a compile-time constant: Event.
    How do I fix this??

  • @lucasmachain
    @lucasmachain 11 ปีที่แล้ว

    very good video ,I speak spanish but I understood everything

  • @PointClickWin
    @PointClickWin  12 ปีที่แล้ว

    It looks like you haven't imported the Event class. Make sure you have import flash.events.Event; underneath the package line in the .as file

  • @larsellars
    @larsellars 12 ปีที่แล้ว

    09:58
    When I am testing it it the trace "made a ship!" doesn't show it says:
    "The defination of base class sprite was not found"
    "The class 'Ship' must subclass 'flash.display.movieclip' since it is linked to a library of that type"
    I double checked everything but i dont see why this is. Is my class propertis wrong or mabey my properties, but they are exacly the same.
    Please help!

  • @wanderfilho
    @wanderfilho 12 ปีที่แล้ว

    I'm using Adobe Flash CS3 Professional.
    Sorry if it's an early doubt.

  • @HayDavo5
    @HayDavo5 10 ปีที่แล้ว

    What if i want the turret to move? what code where do i paste?

  • @omgflyingbanana
    @omgflyingbanana 11 ปีที่แล้ว

    why not use movieclip? I always make little animations and stuff in movieclips and you cant do that with a sprite

  • @Cedeli
    @Cedeli 11 ปีที่แล้ว

    help i am using flash pro CC and the ship is not moving please reply

  • @PointClickWin
    @PointClickWin  13 ปีที่แล้ว

    @bioskok yup yup!

  • @omgflyingbanana
    @omgflyingbanana 11 ปีที่แล้ว

    what is the error message?

  • @mistery1478
    @mistery1478 12 ปีที่แล้ว

    Mr.PointClickWin i'm studying your videos and making the same work until i reached video n°18, with tweens motions, i never had problems until that video!!!
    Can you help me i reached minute 13:56 of the 18th video and you had same problem but changing the code on the game.as you solved it! While i'm still here and completed that video and that code until end, I dont get any errors and i still have black screen! I can only avoid it on flash player by making "reproduce" and not circle HELP tnx.

  • @bltngr
    @bltngr 12 ปีที่แล้ว

    is it ok if im using cs5? cause ive got an error message on part 4 "creating bullets" and im starting again, im guessing that ive got something wrong and hopefully it isnt about the version.

  • @bioskok
    @bioskok 13 ปีที่แล้ว

    Is this for who just finished watching your ''Programming with ActionScript 3'' tutorials :)?

  • @PointClickWin
    @PointClickWin  12 ปีที่แล้ว

    Sounds like you might be in CS4, which doesn't make a class for you when you click the pencil. You'll need to go file -> new and choose ActionScript file. Make your own version of the class and save it in the same place as your .fla
    That should work!

  • @GuitarLessonCharts
    @GuitarLessonCharts 6 ปีที่แล้ว

    I watched this series back in 2012 when I first started programming in actionscript and decided to get back into as3 again so I'm gonna rewatch this series as a bit of a refresher! Looking back and at the time, I almost wish I started with Unity instead of flash seeing as Unity is pretty much compatible across all platforms where as flash is kinda laggy on devices and Unity has way more tutorials now, which makes it easier to learn. With that said, I still think flash holds it's own in the 2d game making world and I'd never have the time to make 3d games anyways. Times sure have changed..
    @PointClickWin do you still program in as3 at all or have you moved onto Unity? (Noticed your newer vids were for Unity)

    • @PointClickWin
      @PointClickWin  6 ปีที่แล้ว

      I only teach Unity now but Flash will always have a place in my heart! It’s not so hard jumping between the 2, so your time in Flash/Animate hasn’t been wasted.
      I’d like to get a few more Unity bits on the channel in future - will have to see if time permits it.

  • @komamon5566
    @komamon5566 12 ปีที่แล้ว

    this is the continue of the scrpit:
    function update(e:Event) {
    x=x+Math.cos(rotation/180*Math.PI)*speed;
    y=y+Math.sin(rotation/180*Math.PI)*speed;
    }
    }
    }
    why doesn't it works?

  • @zambokiller
    @zambokiller 11 ปีที่แล้ว

    Indeed thank you.

  • @mistery1478
    @mistery1478 12 ปีที่แล้ว

    PointClick can u help me please, i'm stopped at video 18 and i get black screen i sent some messages to you, tell me if i can add u as friend i dont know how

  • @PointClickWin
    @PointClickWin  12 ปีที่แล้ว

    Is your library object definitely called ship and not Ship? The capital letter makes all the difference. As a general rule, your classes should always start with upper case letters

  • @bioskok
    @bioskok 13 ปีที่แล้ว

    Should I know what the ''Math''.. ''cos'' and ''sin'' commands do by now? I understand what your doing but those commands.. I got no idea :(

  • @wanderfilho
    @wanderfilho 12 ปีที่แล้ว

    thanks again. i will do this :)

  • @mistery1478
    @mistery1478 12 ปีที่แล้ว

    Sorry for the disturn to help for my problem but i get up 1 hour ago and do the same code for second time but now succesfull!!!
    i recognized my error was to type: "lenght" and not as it must be "length" !!!!!!!!! MY GOD A SPELLING ERROR TOOK ME ABOUT 2 DAYS OF CONCENTRATION :( thanks pointclick same to create those fantastic video collection of as3 RLY TNX, if i have other problems i will contact u i hope with answer this time :)

  • @PointClickWin
    @PointClickWin  13 ปีที่แล้ว

    @KillerPenguin98 Feels good fixing your own stuff doesn't it? :)

  • @Cedeli
    @Cedeli 11 ปีที่แล้ว

    please tell me whats wrong with the code

  • @PointClickWin
    @PointClickWin  12 ปีที่แล้ว

    function update(e.Event) should be a colon instead of a dot. function update(e:Event)

  • @KillerPenguin98
    @KillerPenguin98 13 ปีที่แล้ว

    @KillerPenguin98 //functions
    function Ship() {
    //This is a constructer. This is what happens when a ship is made.
    speed=2+Math.random()*5;
    trace("Made A Ship!")
    //add an event listener tp update every frame
    addEventListener(Event.ENTER_FRAME, update);
    }
    function update(e:Event) {
    x=x+Math.cos(rotation/180*Math.PI)*speed;
    y=y+Math.sin(rotation/180*Math.PI)*speed;
    }
    }
    }
    the ships dont move is there something wrong

  • @PointClickWin
    @PointClickWin  12 ปีที่แล้ว

    Odd :(
    It could be a problem linking the files to your .fla. If you File -> Save as and save it as CS5.5 you can email me it for a look if you like. Email is on my site

  • @komamon5566
    @komamon5566 12 ปีที่แล้ว

    package {
    // import any necessary files/libraries
    import flash.display.Sprite;
    import flash.events.Event;
    // make the class
    public class Ship extends Sprite {
    // tell the class what properties it has
    private var speed:int;
    // functions
    function Ship() {
    // This is the constructor. This happens when a Ship is made.
    speed=5;
    trace("Made a Ship!");
    // add on event listener to update every frame
    addEventListener(Event.ENTER_FRAME, update);
    }

  • @PointClickWin
    @PointClickWin  12 ปีที่แล้ว

    It's very hard to tell from that, I'd need to see the project really.
    You can email me (address is on my site through the channel) and I'll take a look when I get some time

  • @bioskok
    @bioskok 13 ปีที่แล้ว

    @PointClickWin Okay thanks :D!

  • @Djentard
    @Djentard 13 ปีที่แล้ว

    @PointClickWin Thank you :)

  • @1e52gf13
    @1e52gf13 12 ปีที่แล้ว

    Cheers.

  • @theawesome61
    @theawesome61 12 ปีที่แล้ว

    ohh ok thanks :D

  • @eyfeldman
    @eyfeldman 12 ปีที่แล้ว

    make sure that the AS linkage is "Ship"
    and not "ship"

  • @Cedeli
    @Cedeli 11 ปีที่แล้ว

    the code is
    package{
    //import any necessary files/libraries
    import flash.display.Sprite
    import flash.events.Event
    //create class
    public class Ship extends Sprite{//tell the class what properties it hasprivate var speed:int;//functionsfunction Ship(){//this constructer happens when a Ship ismadespeed=5;trace("Made a Ship!")//add an event listener tp update every frame addEventListener(Event.ENTER_FRAME, update);}function update(e:Event){
    i erased the x=x math.....

  • @eyfeldman
    @eyfeldman 12 ปีที่แล้ว

    same

  • @PointClickWin
    @PointClickWin  13 ปีที่แล้ว

    @Magus1508 :)

  • @KillerPenguin98
    @KillerPenguin98 13 ปีที่แล้ว

    @PointClickWin very

  • @KillerPenguin98
    @KillerPenguin98 13 ปีที่แล้ว

    package {
    // import any necessary files/libraries
    import flash.display.Sprite;
    import flash.events.Event;
    //make the class
    public class Ship extends Sprite{
    //tell the clase what properties it has
    private var speed:int;

  • @PointClickWin
    @PointClickWin  13 ปีที่แล้ว

    @IAmSEANN27 If he's creative enough he can make fun stuff without ever doing so much as 2+2!

  • @KillerPenguin98
    @KillerPenguin98 13 ปีที่แล้ว

    @KillerPenguin98 never Mind

  • @mistery1478
    @mistery1478 12 ปีที่แล้ว

    Mr.PointClickWin i'm studying your videos and making the same work until i reached video n°18, with tweens motions, i never had problems until that video!!!
    Can you help me i reached minute 13:56 of the 18th video and you had same problem but changing the code on the game.as you solved it! While i'm still here and completed that video and that code until end, I dont get any errors and i still have black screen! I can only avoid it on flash player by making "reproduce" and not circle HELP tnx.