tag:blogger.com,1999:blog-54192021434516596042024-03-08T07:52:56.888-08:00Making flashgamesdavacahttp://www.blogger.com/profile/08431259617346490235noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-5419202143451659604.post-61063482570492316162011-05-22T08:35:00.000-07:002011-05-22T08:35:57.857-07:00New game in the worksAfter a long silence, here I am again. Currently, I'm in the early development of a new game. I won't say much about it yet, since things are bound to change anyway, but the idea is to satirize some religious stuff. I know, can't be much vaguer, but it'll have to do for now.davacahttp://www.blogger.com/profile/08431259617346490235noreply@blogger.com0tag:blogger.com,1999:blog-5419202143451659604.post-80225067736603073162011-04-10T16:58:00.000-07:002011-04-10T16:58:39.521-07:00Oh dear...Update, just in case somebody cares:<br />
-Dravity hasn't gotten bids yet and I don't really know what to do with it. It also needs some minor fixes which I keep putting of, and I only want to start pushing it when it is fixed.<br />
-No new game is being made. I started something while experimenting with flixel, but it wasn't fun and I didn't know how to implement some things I wanted it to do. <br />
-Instead of continuing my "mess around and see what happens", I bought the actionscript 3.0 bible. I almost completely read it, learned quite a lot, and I'm now also reading some more specific books. I'll start working on something new in a couple of weeks, but not yet...davacahttp://www.blogger.com/profile/08431259617346490235noreply@blogger.com0tag:blogger.com,1999:blog-5419202143451659604.post-39532624560897377522011-02-13T15:47:00.000-08:002011-02-13T15:52:21.963-08:00Dravity: Now on flashgamelicense.Bam!<br />
<br />
it's about time too, when I started I thought it be done early January. Still, better late then never, and I doubt I have hordes of eager fans waiting yet. <br />
If you happen to have a flashgamelicence account, <a href="http://www.flashgamelicense.com/view_game.php?from=dev&game_id=16438">check it out.</a><br />
Sponsors can't see it yet, but I think developers can, and it shouldn't take long for the fgl guys to give it a rating.<br />
<br />
I'm really curious about how it'll do. I hope it gets at least $100, but I have no idea what to actually expect. <br />
<br />
Oh, and I'm going to start working on something new now. A space shooter, I think, but we'll have to wait and see to be sure.davacahttp://www.blogger.com/profile/08431259617346490235noreply@blogger.com0tag:blogger.com,1999:blog-5419202143451659604.post-16534830781446242932011-02-01T11:23:00.000-08:002011-02-01T11:23:33.121-08:00Dravity AnouncementI will finish working on the new game this week, and it's time to get the name out there: Dravity. <br />
I will upload it to flashgamelicence, so it will be a couple more weeks before it's actually out. <br />
<br />
I just need to finish of some levels (while working on this I realized I suck at level design), and it's done!davacahttp://www.blogger.com/profile/08431259617346490235noreply@blogger.com0tag:blogger.com,1999:blog-5419202143451659604.post-15006993592216359232011-01-09T09:50:00.000-08:002011-01-09T10:03:04.149-08:00Grav's source code part IIHere's the last part: gameScreen.as.<br />
<br />
Oh, and by the way: work on the new game is progressing, but rather slowly. I keep running into errors and mistakes, and sometimes it just behaves in completely nonsensical ways... I guess I only have myself and my inexperience to blame. But then I look at this code and I realize I already learned a lot compared to when I wrote this. :)<br />
<br />
<br />
edit: So, blogger ruined the layout, but if you just paste it into your favorite actionscript editor and autoformat it, there'll be no problem, right? <br />
<br />
<a name='more'></a><br />
<blockquote>package asfiles{<br />
import flash.display.*;<br />
import flash.events.*;<br />
import flash.text.*;<br />
import flash.utils.*;<br />
import flash.media.Sound;<br />
import flash.media.SoundChannel;<br />
import com.newgrounds.API;<br />
import com.newgrounds.APIEvent;<br />
import com.newgrounds.Medal;<br />
import asfiles.*;<br />
public class gameScreen extends Sprite {<br />
var Player;<br />
private var theItem:Shape=new Shape ;<br />
private var sidebalk:Sprite=new Sprite ;<br />
private var gravity:Number=3;<br />
private var xspeed:Number=0;<br />
private var yspeed:Number=0;<br />
private var maxspeed:Number=15;<br />
private var xpos:Number=200;<br />
private var ypos:Number=200;<br />
private var rotateto:Number;<br />
private var rotatespeed:Number;<br />
private var left:Number=15;<br />
private var top:Number=15;<br />
private var right:Number=385;<br />
private var bottom:Number=385;<br />
private var jumped:Boolean=false;<br />
private var split:String="horizontal";<br />
private var timer:Timer=new Timer(10000,0);<br />
private var itemTimer:Timer=new Timer(3000,0);<br />
private var endTimer:Timer=new Timer(60000,1);<br />
private var showTime:Timer=new Timer(1000,60);<br />
private var blocka:Shape=new Shape ;<br />
private var blockb:Shape=new Shape ;<br />
private var gravitydirection1:Number;<br />
private var gravitydirection2:Number;<br />
private var inblocka:Boolean=false;<br />
private var inblockb:Boolean=false;<br />
private var itemscought:Number=0;<br />
private var itemCombo:Number=0;<br />
private var bestcombo:Number=0;<br />
private var score:Number=0;<br />
private var timeboard:TextField=new TextField ;<br />
private var scoreboard:TextField=new TextField ;<br />
private var comboboard:TextField = new TextField<br />
private var bestcomboboard:TextField=new TextField<br />
private var timeleft:int=60;<br />
private var timeFont:TextFormat=new TextFormat ;<br />
private var scoreFont:TextFormat=new TextFormat ;<br />
private var multiplierFont:TextFormat=new TextFormat ;<br />
private var multipliers:Array=new Array ;<br />
private var oldx:Number;<br />
private var oldy:Number;<br />
private var bloopsound:*;<br />
private var bloopchannel:SoundChannel;<br />
private var timelefttext:TextField = new TextField<br />
private var timeleftfont:TextFormat = new TextFormat<br />
var medals:Array=API.getMedals();<br />
private var unlockfired:Boolean=false;<br />
public function gameScreen() {<br />
super();<br />
MakePlayer();<br />
MakeSidebalk();<br />
MakeItem();<br />
Player.addEventListener(Event.ADDED_TO_STAGE,playerToStage);<br />
bloopsound = new bloopwav();<br />
}<br />
public function playerToStage(e:Event):void {<br />
stage.addEventListener(KeyboardEvent.KEY_DOWN,playerMovement);<br />
addEventListener(Event.ENTER_FRAME,GravityMovement,false);<br />
timer.start();<br />
timer.addEventListener(TimerEvent.TIMER,gravCreateTimer);<br />
itemTimer.start();<br />
itemTimer.addEventListener(TimerEvent.TIMER,moveItemTimer);<br />
endTimer.start();<br />
endTimer.addEventListener(TimerEvent.TIMER,endListener);<br />
showTime.start();<br />
showTime.addEventListener(TimerEvent.TIMER,showTimefunc);<br />
gravCreate();<br />
}<br />
public function GravityMovement(evt:Event) {<br />
// calculate the movement of the player<br />
if (! (Player.hitTestObject(blocka)&&Player.hitTestObject(blockb))) {//don't turn in the middle<br />
if (Player.rotation!=rotateto) {<br />
if (Player.rotation<0) {
Player.rotation+=360;
} else if (Player.rotation>=360) {<br />
Player.rotation-=360;<br />
}<br />
if (rotateto==0) {//zk omlaag<br />
if (Player.rotation>=180) {<br />
Player.rotation+=360-Player.rotation/3;<br />
} else {<br />
Player.rotation-=Player.rotation/3;<br />
}<br />
}<br />
if (rotateto==90) {//zk links<br />
if (Player.rotation<90) {
Player.rotation+=(90-Player.rotation)/3;
} else if (Player.rotation>=270) {<br />
Player.rotation+=450-Player.rotation/3;<br />
} else if (Player.rotation>90&&Player.rotation<270) {
Player.rotation-=Player.rotation-90/3;
}
}
if (rotateto==180) {//zk omhoog
if (Player.rotation>180) {<br />
Player.rotation-=(Player.rotation-180)/3;<br />
} else if (Player.rotation<180) {
Player.rotation+=(180-Player.rotation)/3;
}
}
if (rotateto==270) {// zk rechts
if (Player.rotation>=270) {<br />
Player.rotation-=(Player.rotation-270)/3;<br />
}<br />
if (Player.rotation<90) {
Player.rotation-=(Player.rotation+90)/3;
}
if (Player.rotation<270&&Player.rotation>=90) {<br />
Player.rotation+=(Player.rotation-90)/3;<br />
}<br />
}<br />
}<br />
}<br />
xpos+=xspeed;<br />
ypos+=yspeed;<br />
if (xpos>right) {<br />
xpos=right;<br />
xspeed=0;<br />
} else if (xpos<left) {
xpos=left;
xspeed=0;
}
if (ypos>bottom) {<br />
ypos=bottom;<br />
yspeed=0;<br />
jumped=false;<br />
} else if (ypos < top) {
ypos=top;
yspeed=0;
}
if (Player.hitTestObject(blocka)) {
switch (gravitydirection1) {
case 0 :
xspeed-=.5;
rotateto=90;
break;
case 1 :
yspeed-=.5;
rotateto=180;
break;
case 2 :
xspeed+=.5;
rotateto=270;
break;
case 3 :
yspeed+=.5;
rotateto=0;
break;
}
inblocka=true;
}
if (Player.hitTestObject(blockb)) {
switch (gravitydirection2) {
case 0 :
xspeed-=.5;
rotateto=90;
break;
case 1 :
yspeed-=.5;
rotateto=180;
break;
case 2 :
xspeed+=.5;
rotateto=270;
break;
case 3 :
yspeed+=.5;
rotateto=0;
break;
}
inblockb=true;
}
if (Player.hitTestObject(blocka)&&Player.hitTestObject(blockb)) {
if (split=="horizontal"&&gravitydirection1==0&&gravitydirection2==2||split=="vertical"&&gravitydirection1==3&&gravitydirection2==1) {
Player.rotation-=10;
if (Player.rotation<0) {
Player.rotation+=360;
}
inblocka=false;
inblockb=false;
} else if (split=="horizontal"&&gravitydirection1==2&&gravitydirection2==0||split=="vertical"&&gravitydirection1==1&&gravitydirection2==3) {
Player.rotation+=10;
if (Player.rotation) {
Player.rotation-=360;
}
inblocka=false;
inblockb=false;
}
}
if (Player.hitTestObject(theItem)) {
oldx=theItem.x;
oldy=theItem.y;
moveItem();
itemscought++;
itemCombo++;
if (itemCombo>bestcombo) {<br />
bestcombo=itemCombo;<br />
}<br />
score+=itemCombo;<br />
scoreboard.text=String("Score: "+score);<br />
scoreboard.setTextFormat(scoreFont);<br />
comboboard.text=String("Combo: " + itemCombo)<br />
comboboard.setTextFormat(scoreFont)<br />
bestcomboboard.text=String("Best combo: "+bestcombo)<br />
bestcomboboard.setTextFormat(scoreFont)<br />
bestcomboboard.wordWrap=true<br />
multipliers[itemscought]=new TextField ;<br />
multipliers[itemscought].text="X"+String(itemCombo);<br />
floatmultiplier(multipliers[itemscought]);<br />
bloopchannel=bloopsound.play();<br />
}<br />
Player.x=xpos;<br />
Player.y=ypos;<br />
if ((!medals[0].unlocked)&&score>=300) {<br />
if (! unlockfired==true) {<br />
unlockfired=true;<br />
API.unlockMedal("300 points!");<br />
}<br />
}<br />
}<br />
public function playerMovement(e:KeyboardEvent) {<br />
// listen for keyboard input<br />
switch (e.keyCode) {<br />
case 37 :<br />
case 65 :<br />
if (xspeed<maxspeed) {
if (inblocka==true&&gravitydirection1==2||inblockb==true&&gravitydirection2==2) {
xspeed-=6;
} else {
xspeed-=3;
}
}
break;
case 38 :
case 87 :
if (yspeed>- maxspeed) {<br />
if (inblocka==true&&gravitydirection1==3||inblockb==true&&gravitydirection2==3) {<br />
yspeed-=6;<br />
} else {<br />
yspeed-=3;<br />
}<br />
}<br />
break;<br />
case 39 :<br />
case 68 :<br />
if (xspeed>- maxspeed) {<br />
if (inblocka==true&&gravitydirection1==0||inblockb==true&&gravitydirection2==0) {<br />
xspeed+=6;<br />
} else {<br />
xspeed+=3;<br />
}<br />
}<br />
break;<br />
case 40 :<br />
case 83 :<br />
if (yspeed<=maxspeed) {
if (inblocka==true&&gravitydirection1==1||inblockb==true&&gravitydirection2==1) {
yspeed+=6;
} else {
yspeed+=3;
}
}
break;
}
}
public function gravCreate() {
//create the gravityfields
if (Math.random()>.5) {<br />
split="horizontal";<br />
} else {<br />
split="vertical";<br />
}<br />
blocka.graphics.clear();<br />
blockb.graphics.clear();<br />
gravityDirection();<br />
if (split=="horizontal") {<br />
blocka.graphics.drawRect(0,0,400,200);<br />
blockb.graphics.drawRect(0,200,400,200);<br />
} else if (split=="vertical") {<br />
blocka.graphics.drawRect(0,0,200,400);<br />
blockb.graphics.drawRect(200,0,200,400);<br />
}<br />
}<br />
private function gravCreateTimer(e:TimerEvent) {<br />
gravCreate();<br />
}<br />
private function moveItemTimer(e:TimerEvent) {<br />
moveItem();<br />
itemCombo=0;<br />
}<br />
private function gravityDirection() {<br />
gravitydirection1=Math.random()*4;<br />
gravitydirection2=Math.random()*4;<br />
if (gravitydirection1<1) {
gravitydirection1=0;
blocka.graphics.beginFill(0xFA4141,.25);
trace("red");
} else if (gravitydirection1<2&&gravitydirection1>=1) {<br />
gravitydirection1=1;<br />
blocka.graphics.beginFill(0xFAF91F,.25);<br />
trace("yellow");<br />
} else if (gravitydirection1<3&&gravitydirection1>2) {<br />
gravitydirection1=2;<br />
blocka.graphics.beginFill(0x214DF8,.25);<br />
trace("blue");<br />
} else {<br />
gravitydirection1=3;<br />
blocka.graphics.beginFill(0x23F523,.25);<br />
trace("green");<br />
}<br />
if (gravitydirection2<1) {
gravitydirection2=0;
blockb.graphics.beginFill(0xFA4141,.25);
} else if (gravitydirection2<2&&gravitydirection2>=1) {<br />
gravitydirection2=1;<br />
blockb.graphics.beginFill(0xFAF91F,.25);<br />
} else if (gravitydirection2<3&&gravitydirection2>2) {<br />
gravitydirection2=2;<br />
blockb.graphics.beginFill(0x214DF8,.25);<br />
} else {<br />
gravitydirection2=3;<br />
blockb.graphics.beginFill(0x23F523,.25);<br />
}<br />
if (gravitydirection1==gravitydirection2) {<br />
gravityDirection();//make sure both field dont have the same direction of gravity<br />
}<br />
}<br />
public function moveItem() {<br />
itemTimer.reset();<br />
itemTimer.start();<br />
theItem.x=Math.random()*390+5;//don't go over the edges<br />
theItem.y=Math.random()*390+5;<br />
}<br />
public function floatmultiplier(mtp) {<br />
var multip;<br />
multip=mtp;<br />
multip.x=oldx;<br />
multip.y=oldy;<br />
multip.selectable=false;<br />
multip.setTextFormat(multiplierFont);<br />
var floattimer:Timer=new Timer(150,15);<br />
floattimer.start();<br />
addChild(multip);<br />
floattimer.addEventListener(TimerEvent.TIMER,floatlistener);<br />
floattimer.addEventListener(TimerEvent.TIMER_COMPLETE,floatstop);<br />
function floatlistener(e:TimerEvent) {<br />
multip.alpha-=0.07;<br />
multip.y-=0.5;<br />
}<br />
function floatstop(e:TimerEvent) {<br />
removeChild(multip);<br />
}<br />
}<br />
public function MakePlayer() {<br />
Player=new Shape ;<br />
Player.graphics.beginFill(0x000000,1);<br />
Player.graphics.drawCircle(0,0,15);<br />
Player.graphics.beginFill(0xFFFFFF,1);<br />
Player.graphics.drawCircle(0,7,3);<br />
Player.graphics.drawCircle(-6,-5.5,2);<br />
Player.graphics.drawCircle(6,-5.5,2);<br />
Player.x=xpos;<br />
Player.y=ypos;<br />
addChild(Player);<br />
addChild(blocka);<br />
addChild(blockb);<br />
}<br />
public function MakeSidebalk() {<br />
sidebalk.graphics.beginFill(0x000000,1);<br />
sidebalk.graphics.drawRect(400,0,150,400);<br />
scoreboard.width=150;<br />
scoreboard.height=150;<br />
scoreboard.x=412;<br />
scoreboard.y=125;<br />
scoreboard.textColor=0xFFFFFF;<br />
scoreboard.text=String("Score: "+score);<br />
comboboard.width=150<br />
comboboard.height=150<br />
comboboard.x=412<br />
comboboard.y=175<br />
comboboard.textColor=0xFFFFFF<br />
comboboard.text=String("Combo: "+itemCombo)<br />
bestcomboboard.width=150<br />
bestcomboboard.height=150<br />
bestcomboboard.x=412<br />
bestcomboboard.y=225<br />
bestcomboboard.textColor=0xFFFFFF<br />
bestcomboboard.text=String("Best combo: "+bestcombo)<br />
bestcomboboard.wordWrap=true<br />
timeboard.width=100;<br />
timeboard.height=75;<br />
timeboard.x=425;<br />
timeboard.y=25;<br />
timeboard.textColor=0xFFFFFF;<br />
timeboard.text=String(timeleft);<br />
timeboard.autoSize=TextFieldAutoSize.LEFT;<br />
timeboard.wordWrap=true;<br />
timelefttext.x=425<br />
timelefttext.y=4<br />
timelefttext.text="Time Left:"<br />
timelefttext.autoSize=TextFieldAutoSize.LEFT;<br />
timeFont.font="arial";<br />
timeFont.size="70";<br />
timeFont.color=0xFFFFFF;<br />
scoreFont.font="arial";<br />
scoreFont.size="25";<br />
scoreFont.color=0xFFFFFF;<br />
timeleftfont.font = "arial"<br />
timeleftfont.size = "20"<br />
timeleftfont.color=0xFFFFFF<br />
timeboard.setTextFormat(timeFont);<br />
scoreboard.setTextFormat(scoreFont);<br />
comboboard.setTextFormat(scoreFont)<br />
bestcomboboard.setTextFormat(scoreFont)<br />
timelefttext.setTextFormat(timeleftfont)<br />
scoreboard.selectable=false;<br />
timeboard.selectable=false;<br />
timelefttext.selectable = false<br />
addChild(sidebalk);<br />
sidebalk.addChild(scoreboard);<br />
sidebalk.addChild(timeboard);<br />
sidebalk.addChild(timelefttext)<br />
sidebalk.addChild(comboboard)<br />
sidebalk.addChild(bestcomboboard)<br />
}<br />
public function MakeItem() {<br />
theItem.graphics.beginFill(0xFFFFFF,1);<br />
theItem.graphics.drawCircle(0,0,7);<br />
theItem.graphics.beginFill(0x000000,1);<br />
theItem.graphics.drawCircle(0,0,5);<br />
theItem.graphics.beginFill(0x24367D);<br />
theItem.graphics.drawCircle(0,0,3);<br />
multiplierFont.font="arial";<br />
multiplierFont.size="25";<br />
multiplierFont.color=0x000000;<br />
addChild(theItem);<br />
moveItem();<br />
}<br />
public function showTimefunc(e:Event) {<br />
timeleft--;<br />
timeboard.text=String(timeleft);<br />
timeboard.setTextFormat(timeFont);<br />
}<br />
public function endListener(event:TimerEvent) {<br />
theEnd();<br />
}<br />
public function theEnd() {<br />
//the end<br />
timer.stop();<br />
itemTimer.stop();<br />
endTimer.stop(); <br />
removeEventListener(KeyboardEvent.KEY_DOWN,playerMovement);<br />
removeEventListener(Event.ENTER_FRAME,GravityMovement,false);<br />
stage.removeEventListener(KeyboardEvent.KEY_DOWN,playerMovement);<br />
removeChild(Player);<br />
removeChild(sidebalk);<br />
removeChild(blocka);<br />
removeChild(blockb);<br />
removeChild(theItem);<br />
var gameover=new Gameover(score,bestcombo);<br />
addChild(gameover);<br />
}<br />
}<br />
}</blockquote>davacahttp://www.blogger.com/profile/08431259617346490235noreply@blogger.com0tag:blogger.com,1999:blog-5419202143451659604.post-18773805428380636782011-01-09T09:41:00.000-08:002011-01-09T10:03:50.641-08:00Grav's source code.Like I promised a while ago, here's the source code for grav:<br />
Main.as:<br />
<blockquote>package asfiles{<br />
import flash.display.*;<br />
import flash.events.ProgressEvent<br />
import com.newgrounds.API;<br />
import asfiles.*;<br />
public class Game extends MovieClip {<br />
var startscreen:*<br />
public function Game() {<br />
var preloadbalk:Sprite = new Sprite<br />
preloader()<br />
function preloader() {<br />
gotoAndStop(1)<br />
preloadbalk.graphics.beginFill(0x000000);<br />
preloadbalk.graphics.drawRect(0,0,550,400);<br />
addChild(preloadbalk);<br />
loaderInfo.addEventListener(ProgressEvent.PROGRESS,loading);<br />
}<br />
function loading(event:ProgressEvent):void {<br />
var pcent:Number=event.bytesLoaded/event.bytesTotal*100;<br />
preloadbalk.scaleX=pcent/100;<br />
if (pcent==100) {<br />
loaderInfo.removeEventListener(ProgressEvent.PROGRESS,loading)<br />
removeChild(preloadbalk)<br />
startscreen = new startScreen()<br />
gotoAndStop(2)<br />
addChild(startscreen)<br />
}<br />
}<br />
}<br />
}<br />
}</blockquote><a name='more'></a><br />
<br />
Gameover.as<br />
<blockquote>package asfiles{<br />
import flash.display.*;<br />
import flash.events.*;<br />
import flash.text.*;<br />
import com.newgrounds.API;<br />
import com.newgrounds.APIEvent;<br />
import com.newgrounds.components.FlashAd<br />
import asfiles.*;<br />
public class Gameover extends Sprite {<br />
var _gameoverscreen:Sprite = new Sprite();<br />
var restarttext:TextField=new TextField ;<br />
var fontFormat:TextFormat = new TextFormat();<br />
var highscoretext:TextField=new TextField ;<br />
var combotext:TextField = new TextField ;<br />
var thescore:Number;<br />
var flashad = new FlashAd<br />
public function Gameover(score, combo) {<br />
thescore=score;<br />
gameoverscreen(score, combo);<br />
}<br />
public function gameoverscreen(score, combo) {<br />
_gameoverscreen.graphics.beginFill(0x000000);<br />
_gameoverscreen.graphics.drawRect(0,0,550,400);<br />
restarttext.x=12;<br />
restarttext.y=25;<br />
restarttext.text="Restart?";<br />
restarttext.selectable=false;<br />
highscoretext.x=12;<br />
highscoretext.y=155;<br />
highscoretext.text="Score: "+score;<br />
combotext.x = 12<br />
combotext.y= 325<br />
combotext.text="Best combo: " + combo<br />
combotext.selectable = false<br />
fontFormat.font="arial";<br />
fontFormat.size="40";<br />
fontFormat.color=0xFFFFFF;<br />
restarttext.setTextFormat(fontFormat);<br />
restarttext.autoSize=TextFieldAutoSize.LEFT;<br />
highscoretext.setTextFormat(fontFormat);<br />
highscoretext.autoSize=TextFieldAutoSize.LEFT;<br />
combotext.setTextFormat(fontFormat)<br />
combotext.autoSize=TextFieldAutoSize.LEFT<br />
addChild(_gameoverscreen);<br />
_gameoverscreen.addChild(restarttext);<br />
_gameoverscreen.addChild(highscoretext);<br />
_gameoverscreen.addChild(combotext)<br />
restarttext.addEventListener(MouseEvent.CLICK,restartclick);<br />
flashad.x = 235<br />
flashad.y = 25<br />
_gameoverscreen.addChild(flashad)<br />
}<br />
public function restartclick(e:Event) {<br />
removeChild(_gameoverscreen);<br />
var startscreen:startScreen=new startScreen();<br />
addChild(startscreen); <br />
}<br />
<br />
}<br />
}</blockquote><br />
and startscreen.as:<br />
<blockquote>package asfiles{<br />
import flash.display.*;<br />
import flash.events.*;<br />
import flash.text.*;<br />
import flash.media.Sound<br />
import flash.media.SoundChannel<br />
import com.newgrounds.API;<br />
import asfiles.*;<br />
public class startScreen extends Sprite {<br />
var startText:TextField=new TextField ;<br />
var helpText:TextField=new TextField ;<br />
var _background:Sprite = new Sprite();<br />
var fontFormat:TextFormat = new TextFormat();<br />
var helpfont:TextFormat = new TextFormat();<br />
var helpon:Boolean=false;<br />
var help:Sprite=new Sprite ;<br />
public var gamescreen:Sprite;<br />
var Player:Sprite;<br />
public function startScreen() {<br />
_background.graphics.beginFill(0x000000);<br />
_background.graphics.drawRect(0,0,550,400);<br />
fontFormat.font="Arial";<br />
fontFormat.size="40";<br />
fontFormat.color=0xFFFFFF;<br />
helpfont.font="arial";<br />
helpfont.size="20";<br />
helpfont.color=0xFFFFFF;<br />
startText.text="Start";<br />
startText.x=50;<br />
startText.y=50;<br />
startText.selectable=false;<br />
helpText.text="Help";<br />
helpText.x=200;<br />
helpText.y=50;<br />
startText.setTextFormat(fontFormat);<br />
helpText.setTextFormat(fontFormat);<br />
helpText.selectable=false;<br />
addChild(_background);<br />
_background.addChild(startText);<br />
_background.addChild(helpText);<br />
startText.addEventListener(MouseEvent.CLICK,startClick);<br />
helpText.addEventListener(MouseEvent.CLICK,helpClick);<br />
<br />
}<br />
public function startClick(evt:MouseEvent) {<br />
removeChild(_background);<br />
if (helpon==true) {<br />
removeChild(help);<br />
}<br />
gamescreen = new gameScreen();<br />
addChild(gamescreen);<br />
}<br />
public function helpClick(evt:MouseEvent) {<br />
if (helpon==false) {<br />
helpon=true;<br />
_background.addChild(help);<br />
var blockleft:Sprite = new Sprite();//red<br />
var blockup:Sprite = new Sprite();//yellow<br />
var blockright:Sprite = new Sprite();//blue<br />
var blockdown:Sprite = new Sprite();//green<br />
var tfleft:TextField=new TextField ;<br />
var tfup:TextField=new TextField ;<br />
var tfright:TextField=new TextField ;<br />
var tfdown:TextField=new TextField ;<br />
var tfhelptext:TextField=new TextField ;<br />
addChild(help);<br />
drawblock(blockleft,0xFA4141,50,175);<br />
drawblock(blockup,0xFAF91F,50,275);<br />
drawblock(blockright,0x214DF8,200,175);<br />
drawblock(blockdown,0x23F523,200,275);<br />
settext(tfleft,"Left",100,175);<br />
settext(tfup,"Up",100,275);<br />
settext(tfright,"Right",250,175);<br />
settext(tfdown,"Down",250,275);<br />
tfhelptext.text="Collect targets. Fight gravity. Get High Score. Use wasd or the arrow keys to move and collect the targets";<br />
tfhelptext.x=365;<br />
tfhelptext.y=50;<br />
tfhelptext.width=175;<br />
tfhelptext.height=350;<br />
tfhelptext.selectable=false;<br />
tfhelptext.setTextFormat(helpfont);<br />
tfhelptext.wordWrap=true;<br />
help.addChild(tfhelptext);<br />
} else {<br />
helpon=false;<br />
removeChild(help);<br />
}<br />
}<br />
public function drawblock(block, color, xpos , ypos) {<br />
block.graphics.beginFill(color);<br />
block.graphics.drawRect(xpos,ypos,50,50);<br />
help.addChild(block);<br />
}<br />
public function settext(textfield,text,x,y) {<br />
textfield.text=text;<br />
textfield.x=x;<br />
textfield.y=y;<br />
textfield.selectable=false;<br />
textfield.setTextFormat(fontFormat);<br />
textfield.autoSize=TextFieldAutoSize.LEFT;<br />
help.addChild(textfield);<br />
}<br />
}<br />
}</blockquote><br />
gamescreen.as will be in the next posts, since it's rather largedavacahttp://www.blogger.com/profile/08431259617346490235noreply@blogger.com0tag:blogger.com,1999:blog-5419202143451659604.post-54859379599254184142010-12-31T09:25:00.000-08:002010-12-31T09:25:28.436-08:00Tits shooting helicoptersA quick game I made:<br />
<a href="http://www.newgrounds.com/dump/item/64971ef17cebb4a811bec334f132e06b">http://www.newgrounds.com/dump/item/64971ef17cebb4a811bec334f132e06b</a>davacahttp://www.blogger.com/profile/08431259617346490235noreply@blogger.com0tag:blogger.com,1999:blog-5419202143451659604.post-24158610427923321232010-12-12T09:08:00.000-08:002010-12-12T15:05:40.810-08:00Grav is dead, long live some new game.Today we celebrate that grav hasn't gotten any views for a whole day. Up to now there always was at least one...<br />
<br />
In other news, I'm attempting to make another game. It's a tile-based platformer, and I'm going to use the little I learned about gravity in this too. The release will be somewhere between next week and next month. Not much else to say, because there simply isn't much else done yet.<br />
<br />
Edit: Well, something odd just happened. Somehow 20 people went to play grav, and I didn't do anything other then post it here. I didn't realise people actually read this :).<br />
hi, people.davacahttp://www.blogger.com/profile/08431259617346490235noreply@blogger.com0tag:blogger.com,1999:blog-5419202143451659604.post-6468669672278330982010-12-08T11:27:00.000-08:002010-12-16T11:40:56.986-08:00Making flashgames: an introductionSo, here I am again, with another blog. I've tried having one before, but I lost interest rather quickly, and I didn't want to try to start those back up.<br />
Anyway, what is this about: A couple of weeks ago, I decided I wanted to learn how to use actionscript. As with blogs, I tried before and failed, but the difference was that back then I tried using actionscript 2, and now I'm using actionscript 3. It's an enormous difference, and somehow it helps to motivate me.<br />
Here's a little game I made:<br />
<a href="http://www.newgrounds.com/portal/view/555530">http://www.newgrounds.com/portal/view/555530</a><br />
I'm not sure if the high score table is working, which is a problem. I also want to submit it to different portals to see how it does in different places, so I think I'll delete the scoreboard for those submissions.<br />
oh, and there's also a medal in there, and I know it does work, newgrounds just hasn't approved of it yet. The bbs keeps telling doom stories about how it can take months before that happens, I hope I'll fare better.<br />
<br />
In the future I hope to talk about other games/projects I make here, and perhaps stuff related to the whole flash game scene. We'll see what happens...davacahttp://www.blogger.com/profile/08431259617346490235noreply@blogger.com0