aenil333
69 posts
|
Topic: Game Programming /
Beta Program
best beta tester are your facebook friends :P you can post the link tought some of us will have a pleasure to check it out
|
|
|
aenil333
69 posts
|
Topic: Game Programming /
Using music in my game
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.net.URLRequest;
var snd:Sound = new Sound();
var channel:SoundChannel = new SoundChannel();
snd.load(new URLRequest("song.mp3"));
snd.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
function onComplete(evt:Event):void {
channel = snd.play();
}
|
|
|
aenil333
69 posts
|
Topic: Game Programming /
Using music in my game
good old midi files ;) 100kb = 1 minute of music
|
|
|
aenil333
69 posts
|
Topic: Game Programming /
Frameworks/engines, how to learn them
flixel is what i learned as3 with… took me some time to get engine to work but once i did i was in a spray to make web site and many thing in flash lol… the tweening effects are just amazing (for a guy like me that doesnt know a shit about maths). But if you want to learn the real thing and you go with flash cs6, check out about starling or go with unity 3d. I personaly think going with any other engine is a waste of time when those does it all and is what being used by pros. Starling use GPU accelerated graphic from c# libraries which will make all your apps faster than only using scripts.
|
|
|
aenil333
69 posts
|
Topic: Game Programming /
How to restart game correctly?
well you know everything start here:
public function Main()
{
addMenuListeners();
addChild(gameLayer);
addChild(backgroundLayer);
addChild(interfaceLayer);
addChild(menuLayer);
menuLayer.addChild(mainMenu);
interfaceLayer.addChild(howtoPlay);
interfaceLayer.addChild(gameEnd);
interfaceLayer.addChild(gameAbout);
soundControl = intro.play(0, 100);
}
All this addchild to stage. By adding them child it start the function and everything you want on the game. So just use removeChild when the guy click restart instead of adding it, remove what need to be removed, then add it again. That is one simple way of doing it.
|
|
|
aenil333
69 posts
|
Topic: Game Programming /
How do I change the font/size of AS3 input text?
wow just saw the date of this post… someone bumped it sorry :\
|
|
|
aenil333
69 posts
|
Topic: Game Programming /
How do I change the font/size of AS3 input text?
ill give you something i started and never finished, but it work… Can give you some hint about using text stuff. You could expand this to use text format like arial etc or more…
package as3
{
import flash.display.Sprite;
import flash.events.Event;
import flash.filters.DropShadowFilter;
import flash.filters.BitmapFilterQuality;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFieldAutoSize;
import flash.utils.setInterval;
import flash.utils.clearInterval;
import fl.transitions.Tween;
import fl.transitions.TweenEvent;
import fl.transitions.easing.*;
public class wl_TextFormats extends Sprite
{
private var xCol:int;
private var yCol:int;
private var xText:String;
private var xColor:uint;
private var xTextSize:int;
private var xVerticalText:Boolean;
private var xEnableShadow:Boolean;
private var xLifeTime:int;
private var xAnim:int;
private var distance:int;
private var angle:int;
private var color;
private var xTextInt:Array = new Array();
private function writeText(e:Event):void
{
var xTextField:TextField = new TextField();
var xTextShadow:DropShadowFilter = new DropShadowFilter();
var xFormat:TextFormat = new TextFormat();
xFormat.font = "Arial";
xFormat.bold = true;
xFormat.color = xColor;
xFormat.size = xTextSize;
xTextField.autoSize = TextFieldAutoSize.CENTER;
xTextField.selectable = false;
xTextField.defaultTextFormat = xFormat;
xTextField.x = xCol;
xTextField.y = yCol;
if (xEnableShadow == true)
{
xTextShadow.distance = 0;
xTextShadow.angle = 0;
xTextShadow.color = 0x000000;
xTextShadow.alpha = 1;
xTextShadow.blurX = 5;
xTextShadow.blurY = 5;
xTextShadow.strength = 5;
xTextShadow.quality = 1;
xTextShadow.inner = false;
xTextShadow.knockout = false;
xTextShadow.hideObject = false;
xTextField.filters = new Array(xTextShadow);
}
if (xVerticalText == true)
{
var textArray:Array = new Array();
var tempText:String = "";
textArray = xText.split("");
for (var i = 0; i < textArray.length; i++)
{
tempText += textArray[i] + "\n";
}
xText = tempText;
}
if (xLifeTime >= 1)
{
var testB:Array = new Array();
var testA:uint = setInterval(destroyText,xLifeTime,xTextField);
testB.push(xTextField,testA);
xTextInt.push(testB);
//effect of fading out
}
if (xAnim == 1)
{
//go up by 100 pixel while fading out
var animation:Tween = new Tween(xTextField, "y", Back.easeOut, yCol, yCol-100, xLifeTime, false);
var xTweenAlpha:Tween = new Tween(xTextField, "alpha", Back.easeOut, 1, 0, xLifeTime / 4, false);
}
else if (xAnim == 2)
{
//fade out
var xTweenAlpha2:Tween = new Tween(xTextField, "alpha", Back.easeOut, 1, 0, xLifeTime / 4, false);
}
xTextField.text = xText;
addChild(xTextField);
}
private function destroyText(textfield:TextField):void
{
for (var i = 0; i < xTextInt.length; i++)
{
var tempText2:TextField = xTextInt[i][0];
if (tempText2 == textfield)
{
clearInterval(xTextInt[i][1]);
xTextInt.splice(i);
removeChild(textfield);
}
}
}
public function wl_TextFormats(xcol:int, ycol:int, xtext:String, xcolor:uint = 0xFFFFFF,xtextSize:int = 14,verticalText:Boolean = false,enableShadow:Boolean = false,lifeTime:int = 0,animation:int = 0)
{
xCol = xcol;
yCol = ycol;
xText = xtext;
xColor = xcolor;
xTextSize = xtextSize;
xVerticalText = verticalText;
xEnableShadow = enableShadow;
xLifeTime = lifeTime;
xAnim = animation;
addEventListener(Event.ADDED_TO_STAGE,writeText);
}
}
}
Simple Usage:
addChild(new wl_TextFormats(x,y,“Text”);
|
|
|
aenil333
69 posts
|
Topic: Game Programming /
One-way platforms
you set var py = platform.y +1.. which mean py will be at the exact position of platform.y + 1 pixel. Use lesser than or greater than operator if you want more.
And main problem with detection collision is if ur player jump and some pixel of the character go in the platform pixel, everything “freeze” cause he always colliding with something. I see you try to remove 3 pixel minus i (which look like a kind of hittest before it actually hit), maybe character go farther than i + 3 pixel… Should trace hes position height and width see if anything still inside the platform
|
|
|
aenil333
69 posts
|
Topic: Game Programming /
rotation on a slope
this look like a kind of user control for 1 plank… if u add a plank in this for dont know what reason you will control them both at same time. If thats what u want, just double the code with plank2…
|
|
|
aenil333
69 posts
|
Topic: Game Programming /
How Do You Pronounce...
char like sharp, without the p, var just like it is, js-on, e-c-m-a script…
|
|
|
aenil333
69 posts
|
Topic: Game Programming /
Collision detection fail
Im trying to understand your simple (x – x % TileWidth)/tileWidth and i just cant figure out how im gonna recognize a tile with a math equation. There is something im missing
|
|
|
aenil333
69 posts
|
Topic: Game Programming /
Collision detection fail
I started with an empty project 3 week ago and this is what i got now… http://learnandplay.99k.org/test.html
Im new to as3 but still want to go with the full thing. And yeah my code may not be that clean since i have pushed over 3k line of code to come to what i got right now, working day and night until i cant see a character anymore. The second array is enemy which are not really present on the map (might go as high as 20 in the max…) Removed double return and the 2 loop each time a key is triggered i just dont know how else i could do this. And i tough variable inside a function would “clean” itself once out of the function :P
|
|
|
aenil333
69 posts
|
Topic: Game Programming /
Collision detection fail
But what if i create one big movieclip with all my little blocking movieclip, could i hittest with only 1 object instead of 127 ? Or thats not possible to do such thing
|
|
|
aenil333
69 posts
|
Topic: Game Programming /
Collision detection fail
well this is kinda what im doing with my hittestpoint ? the Col = -32 (so i create 4 point one top one down one left and one right) then check for collision with a tile… But thats still 127 tile to check with… If i have 30 monster on map checking for 127 tile + me and i dont include bullets shooted from the gun at incredible speed… The result is oblivion
|
|
|
aenil333
69 posts
|
Topic: Game Programming /
Collision detection fail
Im doing hittestpoint with my character…. It wasnt lagging until i add enemies and try to do the same.
public function checkCollision(Col:int,hitDirection:String):Boolean
{
var numObject:int = xMap.objectArray.length;
var numEnemy:int = xEnemy.enemyArray.length;
if (hitDirection == "Left" || hitDirection == "Right")
{
var testA:Point;
testA = new Point(xChar.character.x + Col,xChar.character.y);
for (var s:int = 0; s < numObject; s++)
{
if (xMap.objectArray[s].hitTestPoint(testA.x,testA.y))
{
return true;
}
}
for (var si:int = 0; si < numEnemy; si++)
{
testA = new Point(xChar.character.x + Col,xChar.character.y);
if (xEnemy.enemyArray[si][0].hitTestPoint(testA.x,testA.y))
{
return true;
}
}
return false;
}
else if (hitDirection == "Up" || hitDirection == "Down")
{
var testB:Point;
testB = new Point(xChar.character.x,xChar.character.y + Col);
for (var i:int = 0; i < numObject; i++)
{
if (xMap.objectArray[i].hitTestPoint(testB.x,testB.y))
{
return true;
}
}
for (var su:int = 0; su < numEnemy; su++)
{
testB = new Point(xChar.character.x,xChar.character.y + Col);
if (xEnemy.enemyArray[su][0].hitTestPoint(testB.x,testB.y))
{
return true;
}
}
return false;
}
return false;
}
And thats only the character… I have projectile looking for collision with enemy, + enemies trying to do about the same collision with world object… Right now i have 127 world object to hit with, its becoming too insane. Ive read somewhere i could make just one big sprite out of all my movieclip and try to hit charcter with only 1 object instead of 127 like im doing now… I just dont know how i can copypixel from all movieclip to a sprite or something
|
|
|
aenil333
69 posts
|
|
|
|
aenil333
69 posts
|
Topic: Game Programming /
Collision detection fail
Ok i was trying to do a collision detection system for my character and enemy and came up with this too many for loop, which is looping trough too many tile to check if there is collision, so my game is kinda semi freezing.
I have a hundred square 64×64 pixel which go around my map and inside, every tile made this way is called world object. which is in a objectArray. What i want to do to reduce my lag, and i dont know if its possible, is take all those object (which are movieclips) and make one big one. How could i get this done? copypixel? Im not sure how to do this if anyone ever did this please tell me how to proceed1
|
|
|
aenil333
69 posts
|
|
|
|
aenil333
69 posts
|
Topic: Game Programming /
Jumping with more than 1 in a for loop?
Im trying to do enemy ai and collision with world object and i got this line:
for (var xPath = enemyArray[i][13]; xPath < moving.x; xPath++)
is there a way to jump like 10 instead of xpath ++ (which is only 1..)
|
|
|
aenil333
69 posts
|
Topic: Game Programming /
Game Demo, and a question.
that remind me of my first steps in opengl…
You should add walking motion (like the view go up and down a bit as you walk), also bullet dont come out of the gun but 2 foot after. And particle are fun but its way funnier when they do something else than going in a simple direction :P
|
|
|
aenil333
69 posts
|
Topic: Game Programming /
Tweening and adding child at same time
well instead of adding to the child im adding on the map instead so its working anyway but still find it strange that my textfield wont appear as a child if its tweening…
|
|
|
aenil333
69 posts
|
Topic: Game Programming /
Tweening and adding child at same time
When i tween an object and i try to add a child to it (lets say some text) the text just dont want to appear. Does the tween block from adding child or something?
|
|
|
aenil333
69 posts
|
Topic: Game Programming /
writing text vertically using textfield?
ahhh nice yeah that was the second one thank you!
|
|
|
aenil333
69 posts
|
Topic: Game Programming /
writing text vertically using textfield?
Is it possible ? or do i have to write letter by letter the word then place it vertically..
|
|
|
aenil333
69 posts
|
Topic: Game Programming /
actionscript multiplayer
What suck is i wanted to make the “host” the player to reduce bandwith on server (which would only be used as a chat/game finder system). Its only gonna be 1v1 so…
|