Tuesday, April 29, 2008

From Here on Out

Good song! In any case, my plan for post-windmill construction is to generate a list of all things that have to get done on the game. This will make things move a lot smoother because I can choose a task, focus on it, get it done, and then do the next one. Once these are all done, the product will be a game engine. From that point creating the game will only take a little work and a lot of Ethan's creative brain.

Soon to come: Plan of Action v. 1.0.4.9.1.0.4a.f5.b or whatever the 'first' one normally is.

Wednesday, April 16, 2008

Wind Power in Compy Class?

It's still electricity! Well, not really the same, but today I spent the majority of class learning about the new data logger that Richard has. It's super cool, we got the distance measurer to work. Before I got distracted by that, however, I made an ActionScript file from some code for the player mc. I've dabbled around with includes at home, so that wasn't exactly new, but I commented in the file to make it more universal. For instance, there were some instance-name-specific things in the code, so I just specified what things on the playing field had to be named.

After that, I played around with the enemy mc and now when he gets laser'd he turns into a little money sign. Perhaps I can make it drop random objects, that would be pretty cool! I suppose I would use some sort of random number generator to generate a number from say, 1 to 5. If 1, go to frame A, if 2, go to frame B, etc. The code for what the object is would be on the hitTest on each item frame. I'm really amazed how flexible flash is. The movie clip hierarchy system is very well designed and provides an incredibly easy system for working with more complex things. I think it was wise for Ethan and I to switch from C++ to this because of how basic C++ is, but there are a few other things I want to address in C++. I'll probably just do that on my own time though.

Saturday, April 12, 2008

Ahhhh

My variables are failing me!.. Actually, I'm just using them wrong, but I've implemented the previous knowledge in making the code more streamlined. The savegame function is my next big challenge. To do this, I will have to record the position of the player as _x and _y values, the rotation of the player, which part of the map the player is located in, which items have been taken, which enemies have been killed, etc. It's going to be complicated to get the system up and running, but once it's there things will be easier. The idea is that we're working towards a game engine and once that is figured out we can make challenges, etc. for use in the game itself (so that it's actually fun to play).

Wednesday, April 9, 2008

Variables

Today I figured out a bit more about variables. It seems that in Flash, everything is 'placed' within layers. The layers are determined by movie clips within movie clips.. etc. For instance, to access a clip (foot1) inside of another clip (player) the programmer would have to write _root.player.foot1 This approach goes for variables as well. If a variable (speed) is declared in the foot1 mc, then to access it the programmer must write _root.player.foot.speed ... seems simple enough, right? Well coming from the background of C++ where there were no layers, I assumed that the variables would all be accessible from all code anywhere. Wrong... but the good news is, making variables is very easy. It's as simple as:

var variablename:variabletype = some_initial_value;

For instance...

var money:Number = 0;
//code placed at the very top level of the movie (not in any mc's)

To access this from any mc I would write:

_root.money

For instance, if I wanted to add 50 to the value of money when the player gets 50 moneys, I would put this code:

_root.money += 50;

Simple! This is the great part about AS, once I figure out what the syntax is, it's very fast. I could write out the code to make a pulldown menu function with only a few lines.

Something else that I found out was AS supports "include" files. For instance, I have some chunk of code that makes the mc move with the arrow keys. I could create an actionscript file (.xml if I am remembering correctly) called "arrowkeycontrol.xml" which could be saved in the same directory as the .fla file. I could then type the code #include "arrowkeycontrol.xml" into any mc in that program and it would be controlled by the arrow keys. I could very well have the syntax wrong here, but finding that out is very easy with the actionscript library! I've found it to be the most useful help menu I've encountered!

Tuesday, April 8, 2008

Some homework... =o

At home, I created a movie to test pulldown menus. It worked well, to say the least. I used the code:

on(rollOver){
code;
}
on(rollOut){
code;
}

This controls what happens to movie clips when the cursor moves from being off the movie clip, to on the movie clip (and vice versa). There is one problem however. When the user puts the mouse overtop of the clip to be pulled down, the mask moves and reveals the menu, but when the user goes to click on a menu item, it moves off the original clip to be pulled down, and the menu disappears. I did a little research and downloaded some .fla's from FK but my CS3 trial ran out a while back. I'll have to extract the actionscript while I'm at school, or have someone on the ActionScript.org forums help me out. Menus are something intrinsic to most Flash applications etc. Even if they aren't necessary, they can be very beneficial.

Monday, April 7, 2008



Hope this works!

At a later date: It seems the quality is quite bad, but here's a 'commentary':

The user clicks "New Game" and a game begins. The character (in blue) is controlled by the arrow keys, and the space bar activates his laser beam eyes to kill an enemy. He then goes to collect money and as seen, the inventory records what happens. At the end, the player runs into the castle and wins the game.

Rather basic, but the money took a while and is far from being completed. 'NaN' stands for Not a Number and was a common error while working with the code to get the money to work. Here, it's an item that does nothing... =)

awkefbakwjefbkwaebfgakwgbkwjangkrgr

Today: worked on the game 'engine' ... more specifically, I researched how to use variables! Something that is usually important when programming... I also found out how to change dynamic text from actions (hitTest, buttons, if statement, etc.) Dynamic text is very handy for dynamic things that are text! The one I was working with was money. If the player runs over a hunk of money they have to be able to see the money in their inventory. TODO: figure out how to define global variables or 'more universal' variables. It seems that the variable that I made can only be used within one movie clip.

Thursday, April 3, 2008

Updateeeee

Haven't posted in a while... Here's an update:

Created a laser-eyed player that can zap bad guys and run to the finish with one minor bug of not moving diagonally away from the walls... However, hitting the bad guys results in losing the game...

In the process of: Creating a savegame system. I'm not sure how to store data for users... to the best of my knowledge, Flash doesn't have file I/O built in for security reasons (heavily used for web ads, etc.).

I know there are flash games out there with save options, etc... so we'll see how it goes. I may use level codes and quicksaves...

In any case, it's looking like there will be an actual game this year!