ActionScript 3.0 :: Implementing Dynamic Starfield Into Game
Jun 1, 2011
I'm trying to implement a dynamic starfield into the game blaster mines (chapter 11) from the book "The Essential Guide To Flash Games" (from Jeff and Steve Fulton) but had no success yet. I built a separate starManager.as class and a BasicBlitArrayStar.as class for it. Also I'm using a pool for inactive and active stars (basically I think it's the same method when building the projectiles or rather particles except that the stars move only when the mouse moves (using the same direction).
If u don't know what I mean check out the parallax starfield from [URL]:
freeactionscript.com/2010/06/endless-starfield-parallax-scrolling
Currently it's not working. The inactive pool is full of stars but when I try to draw them on the background I can see absolutely no star. Even when there is an active star available it doesn't draw it on the background. The goal is a starfield that uses similar techniques from the framework like particles and projectiles do. I have some things in mind like getting the child index for creating different star layers but currently I'm not able to realize it properly.
Here are some code excerpts:
starManager.as:
package {
import flash.display.BitmapData;
import com.framework_mod.src.BlitArrayAsset;
import com.framework_mod.src.BasicBlitArrayStar;
[Code] .....
View 1 Replies
Similar Posts:
Jul 17, 2010
I'm a django(python) web developer. I can also make 2D flash games. I'm planning to make :
online flash games distribute them to various websites then use dynamic in-game ads inside these games( ad changes during game play).
[Code]...
View 1 Replies
Nov 19, 2007
why I didn't put it into games category. I've got a game, it's mostly OOP. I've only one frame with "include" statement and the rest is in classes. Now I'd like to do a menu.Can I somehow separate the code of buttons inside menu? I add new frame with a menu MC inside and the "stop()" code. The "start game" button has got this code inside:
Code:
on(release)
{
_root.gotoAndPlay("2");
}
In frame 2 there's a playable part of my game. It works but... Can I move this code somewhere else so I can manage all buttons in one place? I tried:
Code:
_root.menu.start_button.on(release)
But it's not working (as if it should...).
View 7 Replies
Jun 8, 2011
I'm implementing a pause function in a game, it stops the main game timer and then dispatches an event ("Game_Paused") to stop a second timer. Both timers stop (and start) correctly but the second one throws a null object reference error.
Here's the ActionScript Code:
private function onAddedToStage(e:Event):void{
_timerD = new Timer(100);
_timerD.start();
_timerD.addEventListener(TimerEvent.TIMER, onUpdateTime);
stage.addEventListener("Game_Paused", onPauseGame);
[Code] .....
And this is the output:
Code:
Paused Timer=null
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.rtr.game.UI::timer_display/onPauseGame()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.display::Stage/dispatchEvent()
at com.rtr.game::Game_Timer/onKeyDown()
Paused Timer=[object Timer]
What's really confusing me is that the timer is still getting paused correctly, and the trace is showing up in the output before and after the error with two different objects.
View 2 Replies
Mar 30, 2009
is there any easy way to implement this using Flash ?[URL]
View 4 Replies
Aug 27, 2004
I've got a dynamic text box that loads different strings into it under the msgText var right, but the text is like 3 lines long sumtimes. So how can I implement sort of a word wrap kinda thing.
View 2 Replies
May 12, 2010
I want to make a background in an animation that looks like stars going by as a spaceship flies forward.I would like to make stars appear in the distance and then zoom by, very much like the windows screensaver that shows a black screen with stars continually moving toward the viewer.
View 3 Replies
Sep 7, 2007
Is it possible to generate a starfield that can be parallaxed with the mouse? Star is a movieClip in my library which is set to export with actionscript
Current code to generate a static starfield
//import mx. :: I don't recall this exact line of code, but it imports the mx Tween class
import mx.Transitions.*;
var stars:Array = new Array();
var MAX_STARS = 250; // how many stars are allowed on stage at once
var MAX_STAR_SCALE = 4; // the maximum size of a star
for(var i=0; i<MAX_STARS;i++)
[Code] .....
View 4 Replies
Jul 10, 2004
im tryin to rotate this movieclip of a starfield but when i use _rotation i get this flickering effect every second or two of rotation see [URL] left and right keys change rotation hold down a key and you will see what i mean ,is there a way to prevent this flickering here is the code i used
[Code]...
View 1 Replies
Feb 28, 2011
I am making a dynamic image driven game and I am having some problem with preloading all the images at ones, so I am here to seek some help.images is an array that stored the image's url.image_loaded is a variable to see if check how many images have loaded.whenever the image_loaded variables is equals to the images array's length, it will proceed to my desire frame. But for some reason the images isn't showing up all at ones.[code]
View 7 Replies
Mar 20, 2007
I would like one of the dynamic text boxes (picked at random) to display the Answer and the other 3 to be filled in with (Answer+2, Answer-2, Answer*5).My problem seems to be in picking the random box and then assigning Answer to itThis is my test actionscript so far..
questionArray = ["What is 5 multiplied by 5?"];
answerArray = ["25"];
Question = (questionArray [0]);
[code]....
View 4 Replies
Aug 6, 2008
I am making a big big big game, and I came across a huge problem. My game has over 60 unique units, which mean that the library of my .fla file is REALLY huge. Flash just can't handle it anymore, and crashes every 5 min. I can't optimize it(already did) and I can't cut through the content. I think I found a solution: I will load my units from external .swf. Sooo, the thing is, I want to load these swf only once, at the start of the game. Here is how it goes: I divided my units in many packets, and set every unit to be "exported for Actionscript" in the library. This way, ill load the .swf and its library at the beginning of the game and I will be able to attach the units MC over runtime.
[Code]....
View 1 Replies
Jul 30, 2010
I have recently been looking into making a 'spot the difference' type game that will automatically detect the difference between two similar images.It will eventually do the following:compare two imagesdetect and separate the differences (hotspots)create clickable movieclips from the separate objects (differences)So far I have done the following:loaded two images using XMLdrawn these images into separate BitmapData objectsused the 'compare' method of the BitmapData class to detect opaque pixels that are different between the two imagescreated a third BitmapData object containing the differences.How would I separate the third BitmapData object (the differences) into individual objects?I would like to add click functionality to them individually.I'm pretty sure I need to simplify the objects to black and white blobs and then separate them somehow.I just don't know how.I have found algorithms such as marching ants, but i am not sure if this is the right approach for this type of application.
View 9 Replies
Oct 12, 2010
So I'm making a game that uses blocks... I want to create an initial grid of blocks on the screen inside a grid container. as you move the grid container around, more blocks would be added dynamically to the grid... either to the left, right, or bottom.
View 1 Replies
Feb 25, 2011
My game is rather dependant on dynamic text fields, for giving players in game hints, signalling to them how far they've progressed (round/wave), how many points they've scored for destroying an enemy ect.
It's come to my attention that, the game lags whenever I update these dynamic text boxes. This happens particularly with the in game messages, (black glow filter) that fade in and out. Without any dynamic text messages at all, the game seems to run fine even on battery saving mode/slow computers.
Is there anyway to keep the dynamic text and get rid of the lag? I think I've tried all the different options for the textfields (I'm using CS4):Character Embedding Bitmap/Antialiazed text (Bitmap works slightly better) Multiline/single line Non selectable [URL]..
View 2 Replies
Aug 24, 2010
So Im working on a very simple drag and drop flash game using AS3. Everything is complete but I'm having an issue with the dynamic text. For some reason when you drop the item onto its target and accompanying dynamic text is all effed up.. for example when it should say "Try Again!" it says "r ain!".. I've been banging my head for the last few hours with no luck..And here is my code:
Code:
var startX:Number;
var startY:Number;
[code].....
View 2 Replies
Apr 4, 2012
I have here a bubble popping game where bubbles fall from top of the game to the bottom and the player tries to pop as many bubbles as possible in 30 seconds. It is a 3 frame game, 1st frame is the start button, 2nd frame is the game, 3rd frame is the score and play again. 1st frame: Buttons to go to the second frame 2nd Frame: timer to count 30 seconds of play time 3rd frame: buttons to play again. ScoreValue is a dynamic textbox in the last frame of the game. It records the points based on size the size scale of the bubble, and should be change based on the amount of bubbles the player has popped.
[Code]...
Im getting this as output in my program, does any one know why? Fonts should be embedded for any text that may be edited at runtime, other than text with the "Use Device Fonts" setting. Use the Text > Font Embedding command to embed fonts.
View 2 Replies
Jun 26, 2009
I'm doing this object oriented game and I create a bunch of 'boxes' via a for loop
Code:
Select allfor (var z=0; z < numOfBoxes; z++){
var box:Object = new Object();
box.mc = new Box();
box.mc.name = "box"+z
box.mc.x = Math.round((Math.random()*(530-box.mc.width)) + 20);
for (var i=0; i<boxXArray.length; i++){
[Code] .....
I get my random amount of boxes scattered over my stage (I haven't put in any checks to see if they are touching). How do I 'name' these boxes so I can reference them later? Say I want to move the .x of boxA in another function? Is there a simple way to call them box+z instead of just all as box? (Then I can run them through a loop later to talk to them).
View 2 Replies
Apr 24, 2010
I'm trying to work out how to use states in my Flex app.I've created two states, State1 and Stage 2. Both are based off the base state. I've created a few visual elements for State1, and given each of them includeIn="State1".But when I'm in design mode and click on State2, these elements are still visible?If I try to delete them while State2 is selected, all that happens is RemoveChild is added to the State2 tag.
View 1 Replies
Jun 3, 2011
I haven't used the implements keyword before, and I've been trying to use it to implement the IEventDispatcher class to see if this would allow me to use addEventListener() in a class that extends Object (this is my understanding of what it's for - correct me if I'm wrong).My class is like this:
package
{
import flash.events.Event;
[code].....
View 2 Replies
Aug 29, 2011
Within C# there're these things called indexers that do something similar to this:
public Something
{
public Object this[String s]
[code].....
View 1 Replies
Jun 11, 2004
implementing and editing XML within Actionscript worked out swell - no problems so far..but the some_xml.send() seems to become a true nightmare!
Soit, here's an example:
I made a little "keep-in-touch" maillinglist, where visitors can leave their adress, click the "send" button - and let the administrator view the list on a secure page. XML suits fine for this job, i think.
Code:
on (press, keyPress "<Enter>") {
mailInput_xml = new XML();
mailInput_xml.ignoreWhite = true;[code]....
View 2 Replies
Sep 28, 2010
I have a custom form that I want to implement and I am having a problem figuring out how to do so. I want to have it work like an inner popup where it blurs and unblurs the background imageHere's my setup:FLA file contains-UILoader for swf sectionUILoader for random background imageLets say I load a section called home.swf into the section loader. Within the home.swf I have a button for someone to call up the form.swf. Is it possible for the form to blur the random background image when loaded then unblur it when it's done? I also have no idea how to unload it.
View 1 Replies
Aug 2, 2009
I am trying to implement a preloader for loading an swf. I have an swf named 001.swf. I need to create a preloader for loading this swf. So should i create one more swf for loding the 001.swf.
View 7 Replies
Mar 3, 2010
I'm pretty new to Flash, and having a few problems with a website I've had to design for my college ICT course.I built the site entirely in Flash, which went perfectly, then went on to build a scrolling image gallery banner for use on a gallery page of the site (assuming that it would be an easy task to chop the banner into the website).When I've tried importing the file to the stage/library it leaves all the images behind (as they are in the library of the first file) as well as the actionscript required to call the images; leaving me with just a new, blank layer.I've also tried copying the actionscript code into the website document and transferring the images from the gallery library to the website library, however, the gallery is written so that the stage is used in its entirety to show only a certain amount of images, meaning that the proportions of the banner are all wrong on the website file.Is there any way to integrate the flash file for the gallery into a confined area of the stage in the website document, or am I going to have to alter my designs so that the gallery goes entirely across the page (put up and shut up style).
Attatched are download links to the two files in question, sorry if they're a little on the large side.
[Code]...
View 4 Replies
Jun 15, 2010
I cannot believe that implementing a simple class should be so hard. I am trying out the simple example outlined on the Adobe website: url...I copied the class code from here to file Greeter.as in subdirectory Learning. Then I created a dynamic Text field on the stage.
View 3 Replies
Feb 15, 2011
I am looking for a walkthrough for implementing a call for a webservice from an swf file, I cant find any..
View 1 Replies
Jan 15, 2010
Has anyone implemented a Set class in ActionScript? Specifically, a Set which is similar to Python's set implementation (unordered, unique, O(1) membership, etc). I'd like to be able to iterate over it using for each, perform operations like union and intersection and get a list of all the contained items... Which would all be possible to implement using Dictionary and Proxy, but I'd rather not reimplement it if someone's already done the heavy lifting.
View 2 Replies
Feb 21, 2010
I'm developing a flash registration form and I need to incorporate dynamic 'captcha' images for confirmation.
View 6 Replies
Sep 22, 2010
Ours is a Flex/Parsley/Blazeds/Spring project & I'm trying to implement java Enums in Actionscript3 and all I have to do is to send the Enum value to Spring service method.
The Java Enum Code (this is generated from XSD)
public enum ReferenceLookupType {
PATIENT_VISIT_TYPE("PATIENT_VISIT_TYPE"), PATIENT_STATUS("PATIENT_STATUS"),
PATIENT_VISIT_INVALID_REASON("PATIENT_VISIT_INVALID_REASON"),
LIPID_PREFILLED_CODE("LIPID_PREFILLED_CODE");
private final String value;
[Code] .....
How to implement Enums in Actionscript the right way.
View 1 Replies