Thursday, June 24, 2010
Cassius & Cassandra
This is probably what I'd have for a webcomic if I regularly did webcomics. No, actually I'd have something more random. This is just something from a sketchbook of mine that I figured was funny enough to share. But I'll leave the contents of the previous page up to your imagination.
Friday, June 11, 2010
Spacewar in under 100 lines?
I'm a little crazy, but I'm trying to code a clone of the ol' classic game "Spacewar" in under 100 lines in ActionScript 2. I did this before with code spread about on different movieclips and had a semi-playable game working. But now I'm trying something a little harder. This time I'm trying to keep all the actions together on the main timeline with the added challenge of trying to make better use of OOP conventions to better cover steps that repeat. So far I got it up to the point where it makes the bullets, but it doesn't quite shoot them. Hell, it's hard enough trying to figure out how I did it the first time around - being that I haven't done much in scripting for a long time. Anyhow... Here's the code:
// This is the section with the actual game.
// Create the Ship() constructor class.
function Ship(rot, xP, yP, player) {
this.rotation = rot;
this.xVelocity = 0;
this.yVelocity = 0;
this.hitPoints = 100;
this.player = player;
}
// Adding methods to Ship class.
Ship.prototype.applyThrust = function() {
trace("Applying thrust to "+this.player);
angleDeg = (this.rotation<0)*360+this.rotation;
angleRad = (angleDeg/180)*Math.PI;
this.xVelocity += (Math.sin(angleRad)*.75);
this.yVelocity -= (Math.cos(angleRad)*.75);
};
Ship.prototype.turnLeft = function() {
trace("Turning "+this.player+" left");
this.rotation -= 10;
};
Ship.prototype.turnRight = function() {
trace("Turning "+this.player+" right");
this.rotation += 10;
};
Ship.prototype.fireGun = function() {
trace(this.player+" is firing their gun.");
_root.attachMovie("bullet", this.player+"Shot_mc", 10);
_root[this.player+"Shot_mc"]._x = _root[this.player+"_Ship_mc"]._x;
_root[this.player+"Shot_mc"]._y = _root[this.player+"_Ship_mc"]._y;
};
Ship.prototype.calcMovement = function(clipID) {
clipID._rotation = this.rotation;
clipID._x += this.xVelocity+((clipID._x<0)*640)-((clipID._x>640)*640);
clipID._y += this.yVelocity+((clipID._y<0)*480)-((clipID._y>480)*480);
};
var P1_Ship = new Ship(0, 10, 10, "P1");
var P2_Ship = new Ship(0, 100, 10, "P2");
for (var prop in P1_Ship) {
trace("property "+prop+" value is "+P1_Ship[prop]);
}
function testLoop() {
if (Key.isDown(87) == true) {
P1_Ship.applyThrust();
}
if (Key.isDown(65) == true) {
P1_Ship.turnLeft();
}
if (Key.isDown(68) == true) {
P1_Ship.turnRight();
}
if (Key.isDown(83)) {
P1_Ship.fireGun(P1_Ship_mc);
}
if (Key.isDown(38)) {
P2_Ship.applyThrust();
}
if (Key.isDown(37)) {
P2_Ship.turnLeft();
}
if (Key.isDown(39)) {
P2_Ship.turnRight();
}
if (Key.isDown(40)) {
P2_Ship.fireGun(P2_Ship_mc);
}
P1_Ship.calcMovement(P1_Ship_mc);
P2_Ship.calcMovement(P2_Ship_mc);
}
setInterval(testLoop, 60);
stop();
Oh, and I'm using only 3 movieclips if you haven't figured it out. And adding sound shouldn't be too terrible either, even though I haven't got to that yet.
// This is the section with the actual game.
// Create the Ship() constructor class.
function Ship(rot, xP, yP, player) {
this.rotation = rot;
this.xVelocity = 0;
this.yVelocity = 0;
this.hitPoints = 100;
this.player = player;
}
// Adding methods to Ship class.
Ship.prototype.applyThrust = function() {
trace("Applying thrust to "+this.player);
angleDeg = (this.rotation<0)*360+this.rotation;
angleRad = (angleDeg/180)*Math.PI;
this.xVelocity += (Math.sin(angleRad)*.75);
this.yVelocity -= (Math.cos(angleRad)*.75);
};
Ship.prototype.turnLeft = function() {
trace("Turning "+this.player+" left");
this.rotation -= 10;
};
Ship.prototype.turnRight = function() {
trace("Turning "+this.player+" right");
this.rotation += 10;
};
Ship.prototype.fireGun = function() {
trace(this.player+" is firing their gun.");
_root.attachMovie("bullet", this.player+"Shot_mc", 10);
_root[this.player+"Shot_mc"]._x = _root[this.player+"_Ship_mc"]._x;
_root[this.player+"Shot_mc"]._y = _root[this.player+"_Ship_mc"]._y;
};
Ship.prototype.calcMovement = function(clipID) {
clipID._rotation = this.rotation;
clipID._x += this.xVelocity+((clipID._x<0)*640)-((clipID._x>640)*640);
clipID._y += this.yVelocity+((clipID._y<0)*480)-((clipID._y>480)*480);
};
var P1_Ship = new Ship(0, 10, 10, "P1");
var P2_Ship = new Ship(0, 100, 10, "P2");
for (var prop in P1_Ship) {
trace("property "+prop+" value is "+P1_Ship[prop]);
}
function testLoop() {
if (Key.isDown(87) == true) {
P1_Ship.applyThrust();
}
if (Key.isDown(65) == true) {
P1_Ship.turnLeft();
}
if (Key.isDown(68) == true) {
P1_Ship.turnRight();
}
if (Key.isDown(83)) {
P1_Ship.fireGun(P1_Ship_mc);
}
if (Key.isDown(38)) {
P2_Ship.applyThrust();
}
if (Key.isDown(37)) {
P2_Ship.turnLeft();
}
if (Key.isDown(39)) {
P2_Ship.turnRight();
}
if (Key.isDown(40)) {
P2_Ship.fireGun(P2_Ship_mc);
}
P1_Ship.calcMovement(P1_Ship_mc);
P2_Ship.calcMovement(P2_Ship_mc);
}
setInterval(testLoop, 60);
stop();
Oh, and I'm using only 3 movieclips if you haven't figured it out. And adding sound shouldn't be too terrible either, even though I haven't got to that yet.
Wednesday, June 09, 2010
SEO in Waukegan is easy.
Check this out. If you're in a city of less than 100,000 and you localize your information on your website or blog, it's really easy to optimize for a search engine. If you put enough info, it should happen on its own. Regarding that, I'd be willing to bet a dollar that this blog will be somewhere in the first three pages containing the words "SEO" and "Waukegan". And I'm not really trying hard. If you're paying a lot for such services, and you're a small town business catering to a small town audience... Well, you know the ol' adage about a fool and their money.
But hey I'm just one guy that does freelance work as a graphic artist. So what do I know about this kind of stuff? And it's not like you found my blog via those keywords right? ;)
But hey I'm just one guy that does freelance work as a graphic artist. So what do I know about this kind of stuff? And it's not like you found my blog via those keywords right? ;)
Friday, June 04, 2010
The Smallest Graphic Design Place in Waukegan
This is it, my freelancing is the smallest graphic design place in Waukegan. I haven't seen a mention of this site in regards to my hometown, so may as well make it be known. (Although I try to do most stuff over the net, but still I think there may be location specific stuff available.)
Some people may claim to be small, but me? I don't even have a large format printer yet, and I'm a one man show. The real problem is letting people know that there's good talent in their own backyard. And short of doing print jobs (which would still have to go outside), I can do some pretty cool things design-wise. If you want 3D visualizations or animations, Illustrations, and Logos, it will be harder to find better bang for the buck.
So if you've managed to stumble on this, fire off a comment. Or give a hint at your email. Or if that's too much work, here's a hint of mine: pop alpha uniform luck jump snake 7 5 (at) hotmail.
Some people may claim to be small, but me? I don't even have a large format printer yet, and I'm a one man show. The real problem is letting people know that there's good talent in their own backyard. And short of doing print jobs (which would still have to go outside), I can do some pretty cool things design-wise. If you want 3D visualizations or animations, Illustrations, and Logos, it will be harder to find better bang for the buck.
So if you've managed to stumble on this, fire off a comment. Or give a hint at your email. Or if that's too much work, here's a hint of mine: pop alpha uniform luck jump snake 7 5 (at) hotmail.
Subscribe to:
Posts (Atom)