Thursday, March 27, 2008

A Game!

There is now a game! It has instructions, it has a way to win, it can get really boring, and it has bugs! woohoo!

Wednesday, March 26, 2008

Universal Wall Code

The moment of truth... a C&Pable chunk of wall! I have formulated some code to be applied to an mc(movie clip) so that it becomes a wall. It was pretty easy now that I know what I'm doing. I also figured out how to control the movie clip from hitTest.

Here is the code for the universal wall:

onClipEvent(enterFrame){ //code applied to the mc of the wall
if(this.hitTest(_root.player.head)){
_root.player._x = this._x - 13;
}
}

And here is the code applied to the player to make the hitTest control the movie itself:

if(this.hitTest(_root.win)){
this.stop();
_root.gotoAndStop(20);
}

Turns out I have to stop the movie before I switch frames...

In other news, the naming scheme is as such: Graphical entities are name_g, Movie Clip entities are movieClip_mc, and Button entities are button_b (this was a naming scheme I adapted from the flash book back in 9th grade...)

Monday, March 24, 2008

-insert title here-

So I haven't sketched so much detail yet... although I do have some. One thing I'm struggling with is hitTest combined with clip control. For instance, when el protagonist runs into the random blue square ... the movie goes to a new scene. However, that hasn't worked thus far.

onClipEvent(enterFrame){
if(_root.winsquare, hitTest(_root.player)){
gotoAndStop(5);
}
}

The above code has no affect on the movie....

//this code to go in main actions layer...
if(_root.winsquare, hitTest(_root.player)){
gotoAndStop(5);
}

This, however, seems to skip straight to frame 5 even if the player has not hit the block yet....

AGH! ... =D

in other news, Richard helped out with the FTP site, so I'll have to get Ethan set up with that soon... and I'll also have to cram some of my movies up there. If I can figure out how to make a folder public I can post links from this blog so that people can see my progress. Otherwise it'll be peering over shoulders, posted code, and screenshots!

Friday, March 21, 2008

Arrow keys > four buttons?

Arrow keys have become much more than four buttons. Combining acceleration, deceleration, rotations, achieving 'static' position, angle movements, and a zillion other things have added to the confusion of the four buttons known as "the arrow keys." Of course, this poses the question: what exactly do I want the keys to do? Is acceleration the best thing for a person walking on the ground? For a car? Is the deceleration the same for a rolling ball and a car? Perhaps it's time for the sketchbook again...! This time I'm much more informed about how detailed I can make things while not even working on the computer. That way if I have a goal in mind, I can program exactly that goal and not get distracted. I've noticed this urge in myself to see if I can do something even if it doesn't help me achieve the goal at hand. This is actually pretty stupid because if I spend too much time figuring out a zillion ways to use arrow keys, I'll never have anything to show other than a zillion arrow key programs... or one, if I keep changing the same thing! Conclusion: SKETCHBOOK.

AccelerationnnnnnnnnnNNNNNN

Figured out some code for acceleration and applied it to my little car that I've been testing things on. Here's some code:

_x += speedh;
speedh += .1;
//happens if Key.isDown

Apparently the computer will determine my variable types for me. If I C&P that code right there into any if(Key.isDown(Key.KEY)){ thing it will work. I don't have to define what speedh is anywhere else. (speedh stands for horizontal speed)

I'm going to set up an FTP so that I can host files on my domain name. After I do that I'll be able to post links to .swf files to make reading this more fun =D

Flash++

While working in C++, I found that in order to make a few little things, I would have to type a zillion lines of code. Most of this was the process of creating visuals. Without visuals, programs are reduced to the bare minimum: function only. Sometimes, however, it's nice to have some graphics! Flash, a program written in C++, provided a very flexible process for making visuals as well as an intuitive programming language of it's own (ActionScript). Of course, there are more limitations for this, but the fact of the matter is, I can make a program in Flash that would take years of typing in C++, and technically, I'm still working in C++!!! It would be interesting to figure out how to input and output to ascii files from Flash... being C++ based, it shouldn't be much different (although, as we've discussed, most programming languages are about the same).

Thursday, March 20, 2008

Movements and hitTests

Figured out diagonal movement and a better method for arrow keys:

onClipEvent(enterFrame){
if(Key.isDown(Key.LEFT)){
_x -= 2;
}
}
//left arrow key moves the guy leftwards WHEN THE KEY IS DOWN as opposed to when it is pressed... which is much more jumpy.

Also:

onClipEvent(enterFrame){
if(Key.isDown(Key.LEFT) && Key.isDown(Key.UP)){
_x--;
_y--;
_rotation = 315;
}
}
//moves left AND up (and rotates the object 315 degrees so that it faces the top left of the screen

Wednesday, March 19, 2008

hitTest

Tried to figure out how to configure a hitTest between two objects in actionscript 2 (AS2). Unsuccessful! Went here to get a tutorial/movie thing:

http://www.kirupa.com/developer/actionscript/hittest.htm

It was made for Flash 5, however it worked fine in MX04. Mine didn't work... I still have to figure that out. Perhaps it's because I have a zillion scenes in the 'movie' which are mostly useless menus. I tried to loop the one scene by using two frames and using 'gotoAndPlay' to itself. It seems like I still have a bit of tinkering to do, because I have an idea where I might nest the hitTest down in the movie clip objects to isolate it. If that fails..... who knows o.O

Monday, March 17, 2008

Screenshots soon?

Well I decided to re-explore flash because I was getting sick of how limited C++ is. I made a basic menu interface within one class period, which is rather impressive compared to what I've been able to do all year with C++. Ethan found two of my syntax errors and debugged them with his mystical powers of Ethan-is-good-at-debuggingness. Perhaps I'll have some screenshots soon!

Thursday, March 13, 2008

VC Is A PAIN

After two class periods I finally got Microsoft Visual C++ installed on this computer. The program I wrote in it at home didn't work for some reason, and when I made a new "blank" project it had enough code to fill 309 pages of a MS Word document! When I ran the program it made a blank window... Perhaps tomorrow I'll figure out how to start with a "void" program or something... blank didn't seem to be the right thing to start with!