Archive for the 'Actionscript 3.0' Category
Status: AS3.0 game programming tutorials
I had a query regarding the game programming tutorials I’ve been working on. The query is “Where the heck are they?”
Here’s a quick status. I would like to have the game completed before I posted the rest of the tutorials. However, due to some unforeseen circumstances the actual game itself is held up (it’s 94% finished, just hung up getting some animations done).
I’m a little split on if I should go ahead and continue the tutorials with the game as-is, or if I should go ahead and wait for a polished product to deliver to you guys.
What would you guys prefer?
LB
3 commentsAnother Tricky Flex 2 Error
Ran into another Flex 2 error the other day that’s again not crystal clear about what it’s trying to tell you. This one is:
Invalid Embed directive in stylesheet - can’t resolve source ‘Embed(source = “assets/my_picture.png”)’
Here’s the source:
1 2 3 4 5 6 | <mx:style> .customVideoTree { defaultLeafIcon:Embed(source="assets/ds-qhv-film-icon.png"); } </mx:style> |
This one is pretty clear in hindsight, but care to guess what that error up there means to say? My initial thinking was that it was a syntax error with the Embed directive, but nope, the $25,000 answer is. . .
file not found
Now you know what can’t resolve source means, which of course makes perfect sense now. . .but sure tripped my up on the spot.
LB
1 commentFlex 2 Strange Error
I ran into an error while working on a Flex2 application this morning. The error made zero sense in the context, and I wasn’t able to find anything that explained it (reasonably) via google. So, here’s what I found the hard way :
The error was:
[RPC Fault faultString=”Error #2070: Security sandbox violation: caller cannot access Stage owned by .” faultCode=”Client.CouldNotDecode” faultDetail=”null”]
Here’s some sample code that will replicate the error:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <mx:application xmlns:mx="http://www.adobe.com/2006/mxml" width="800" height="600"> initialize="e4xService.send()"> <mx:script> <!--[CDATA[ public function handleHttpResult(event:Event):void { } ]]--> </mx:script> <mx:httpservice id="e4xService" url="assets/videos.xml" result="handleHttpResult(event)"> </mx:httpservice> </mx:application> |
And here’s some example XML for the “assets/videos.xml” file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | <applications> <application label="Web Application"> <category label="Upload Manager Set Up"> <category label="Basic File Operations"> <subcategory label="Uploading"> <subcategory label="Downloading"> <subcategory label="Moving and Cut Paste"> <subcategory label="Deleting and Recovering"> <subcategory label="Creating Folders"> <subcategory label="Setting View Mode"> </subcategory> <category label="Sharing"> <subcategory label="Shared Folders"> <subcategory label="Shared Files"> <subcategory label="Temporary Passwords"> </subcategory> <category label="Address Book"> <category label="Billing"> <category label="Sub-Accounts"> <category label="Search"> <category label="Web Import (Advanced)"> <category label="Multimedia"> </category> <application label="Desktop Application"></application> <category label="Desktop Application Install"> <category label="Basic File Operations"> <subcategory label="Uploading"> <subcategory label="Downloading"> <subcategory label="Moving and Cut Paste"> <subcategory label="Deleting and Recovering"> </subcategory> <category label="Sharing"> <subcategory label="Shared Folders"> <subcategory label="Shared Files"> </subcategory> <category label="Backups"> <category label="Syncing"> </category> </category> </subcategory></category></subcategory></subcategory></subcategory></category></category></category></category></category></category></category></subcategory></subcategory></category></subcategory></subcategory></subcategory></subcategory></subcategory></category></category></application></applications> |
Line 25 had some poorly formatted XML; “<application label=”Desktop Application”/>” (Closing the tag while it had children). This was my problem.
So, the short answer is: If you see this problem and you’re remotely loading an xml file, go over your xml with a fine toothed comb. The text of the error doesn’t make a lot of sense in context.
Hope that helps!
LB
6 commentsActionscript 3.0 Game Programming - Part 2 - The Tools
Welcome back. Today I’m going to give you a brief overview of the tools that I am using for developing a game in Actionscript 3.0. I’m also going to throw in a bonus paragraph or two and describe Quacker Whacker in more detail as I should have done in Part 1.
There are, of course, options for everything, but the tools I seem to have settled on are Flexbuilder 3.0 beta (free public beta until release, Flexbuilder 2 is fine also), Adobe Flash CS3, and Adobe Illustrator CS3 and Photoshop CS3(sort of, I’m very novice with the last 2).
Flexbuilder is my IDE, it’s based on Eclipse (my personal favorite) and does most of the nifty-cool things that an IDE should do; code highlighting, in-flight error checking, running the app, full debugger, etc. The one thing is doesn’t have, that I have been able to find is snippets - the ability to attach some tedious, often used bit of code to an expandable abbreviation. All of the Actionscript coding is done here, along with your frequent testing and debugging. It is NOT necessary to use Flexbuilder to create Flex or Actionscript applications, the Flex framework is free and contains command line compilers. However, the how-to on using the command line stuff is beyond the scope of this article and is covered heavily in other books and sites.
The 2nd piece of the puzzle is Flash itself. I know. . I know, in the intro article I said that is what I was trying to avoid. The reason I wanted to avoid it though is because it’s not designed for programmers to create large amounts of code. It was, however, created for animators and graphics geeks to do what they do best, and in that, it excels. So, yes, I do use Flash, but I’m only using it to create my animated assets which are then imported in the game as objects that I am free to instantiate and use as I see fit. It’s really very cool. I’ll be covering how to create an asset in Flash, export it to Actionscript, and using it in the game (from a very novice graphics standpoint).
The final tools mentioned are Adobe Illustrator CS3, and Adobe Photoshop CS3, and mentioning them is about all I’m going to do. If Mr. Right-Brain is interested in doing an article on them I would encourage that. But I’m very much a novice and would probably do you more harm than good ; ) They are being mentioned, however, as these tools, or tools like them, are very important in this process for making really super-duper graphics, especially when you start making games that you want the public at large to enjoy. Typically the base graphic assets would be created and tweaked with these applications before moving them into flash for animation.
So, those are the tools in a nutshell. Now for the bonus material. What is Quacker Whacker?
As I mentioned in the intro article, Quacker Whacker is a knock off of the old Galaga/Space Invader type games. There’s a formation of ducks that fly across the screen. While making this journey they have the potential to poo or to drop eggs. The hunter is at the bottom of the screen and is able to shoot the ducks with one of 3 types of rifle, semi-automatic, automatic, or shotgun. If the hunter is hit by a poo, splat, he loses a hat (life). If the hunter catches an egg, he is gifted with a bonus. . .score, new gun, ammo, extra hat (life), etc. When the flock goes off one side of the screen, the flock will drop down a bit, turn around and cross the screen in the other direction. The hunter gets bonus points when he shoots the entire flock. The earlier he does this, the higher the bonus. Finally, it’s not implemented yet, but there are plans for a Hawk that will dive at the hunter. The hunter must shoot the hawk or be got by it. There will be a large bonus for shooting the hawk. That’s the basics of the game.
That’s it for this installment. Join me again next week when we will discuss the basics of creating a game. The various screens, game manager, game loop, etc. There will be code (finally)!!
See ya then!!
1 commentActionscript 3.0 Game Programming - Part 1 - Introduction
Adobe Flash content. . .it’s everywhere. Can’t hardly look at a web page without seeing some, and it makes up an astounding chunk of the casual games market. It’s installed on damned near every single individual’s machine, and it’s kept current by the Flash update mechanism. It’s been around forever, had very few problems (that I’m aware of), and is just about universally trusted as an interactive content delivery mechanism (as well as loathed as an ad delivery mechanism . . .who cares how many bananas I can peel for a free iPod? hehe, whatever!)
This, friends, is obviously the place to be if you want to create software in the casual games space. However, there is one BIG historical problem. Creating games in the Flash application, via the time-line concept, is not very intuitive for us “real” programmer types if not down right confusing*. It’s definitely something that’s easier for the designer types, and has provided them with incredible opportunities to break into that space. However, times are a-changin’. With the introduction of FlexBuilder 2.0, Actionscript 3.0, and Flash CS3, us software engineering types can finally get into the game with gusto. And let me tell you something. . .I, for one, am LOVING it!
So, I guess I’m going to try and share the love a bit. I’m just about finished writing a game called Quacker Whacker. It’s a loose and wholly silly take off of the Space Invaders/Galaga platform games and was conceived and created strictly as a learning project for this technology. The goal was to do it strictly as a coding (AS3.0) project, not a bunch of Flash, etc. I have deviated from this a bit and used Flash to develop my animated assets. Flash is NOT necessary, but I think it’s a very strong and complementary tool in this context. I think as we go on, you’ll probably agree.
In these tutorials I will cover a number of topics that are specifically related to this technology. It is not my plan to get into good game design (which this game doesn’t demonstrate anyway : b), coding practices, how to create the Flash assets (aside from what’s important with this specific set of tools), etc. This tutorial will not be a 0-100 walk-through of creating the game. However, I will be providing complete sources (code, and assets), and the game itself will be available to check out.
I think that pretty much wraps up the introduction. It is my intention to post a new section of the tutorial at least once a week for the next 3-4 weeks. The next section to come next week will look at the tools we’re going to be working with, including: FlexBuilder, Flash CS3, and Illustrator.
LB
P.S. If there’s something you are interested in seeing in the tutorial, let me know. I don’t have it completely developed yet so there’s room for additions and now is the time ; )
* I know I’m leaving out some technologies that allowed you to programatically build flash content. But I’m pretty much a stickler for standards personally. So I just never totally warmed up to them.
4 comments