ActionScript :: Game Loop Not Running?

Feb 19, 2012

I'm developing a Flash game using ActionScript 3 and have this code in my documents class:

package com {
import flash.display.MovieClip;
import flash.display.Stage;
public function Engine() {
// Create a player instance

[Code]...

Is there a library or something I need to import to get this to work? If it's not obvious, I want to run the gameLoop method of my Engine class (the documents class) on every new frame (the document is currently set to 30fps).

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Game Running Slow In A Browser?

Oct 17, 2010

my game running very slow in all the browsers but its OK as a standalone application.

View 3 Replies

ActionScript 3.0 :: Create A Running Debug Log For The Game?

Feb 7, 2012

I have trace statements all over that I may or may not comment out for debugging purposes, once I am done working on some segment.

-init
-game menu entered
...waiting
-instructions open

[code]....

Is this ever done for a debugging workflow? I feel like its a way I could have written notes to myself instead of re-learning some code that I forgot about any might have hacked together at the time.

View 1 Replies

Actionscript 3 :: Making Platform Game Method To Stop Running?

Mar 13, 2012

I am making a platform game in flash. I have a goal class(the class which contains code for the goal sprite, where when you hit it, it continues to next part of game).

[Code]...

The beginClass function is fine, and only runs once, but eFrame is what checks if the player has hit the goal, so it is constantly running. The problem is, once the player hits the goal, eFrame continues to run, while in a menu describing the next scene to the player. My eFrame function is below.

[Code]...

View 3 Replies

ActionScript 2.0 :: For Loop With A Pause Before Running Again

May 1, 2007

I'm trying to run a for loop for my game that runs once, waits a certain amount of time, then runs again. I'm trying it with setInterval but so far no luck. Could someone please give me an example of some code that would cause this to happen.

View 14 Replies

Professional :: Making A Simple Game With Video Stills Matching A Running Audio Track?

Nov 18, 2010

making a simple game with video stills matching a running audio track.my audio is an MP3 i built in GarageBand. all works well in flash, but when rendered to QT, the audio and video go out of sync, and some video drops out too.have put all audios on their own layer and streamed them all too, set settings in Publish to 64, but still have same problem

View 1 Replies

Flash :: Running Movie Backwards Automatically Then Loop Again?

Jan 21, 2010

I'm SO new to scripting. I find it all a bit daunting I have a Flash movie that runs for about 300 frames, then I'd like it to run backwards once it's reached the last frame, then play again from the beginning, and loop from there.

So really forward end frame reverse loop play again (loop) Is there an easy way to script this? I think I can figure out the first frame, but what would one put at the last frame?

View 7 Replies

ActionScript 3.0 :: For Loop Running Infinite Times When Triggered

Mar 30, 2011

I've got this for loop, but for some weird reason it malfunctions:
- When triggered, it runs infinite times.
- It only triggers when segmenten1 or segmenten3 are 0, which is weird, because it should also work when segmenten0 and 2 and 4 are 0...

Here is the for loop:
stage.addEventListener(Event.ENTER_FRAME,addmetaal);
function addmetaal (evt:Event) {
for(var animteller=0;animteller<5;animteller++){
if (this["segmenten"+animteller]==0) {
[Code] .....

It seems to me like that when any of the segmented variables hits 0, it should trigger 2nd for loop, and repeat that 4 times. The xco and yco are arrays which store values for the x and y coordinates for spwaning the addchilds, this works fine.
the segmented variables are declared as following:
var segmenten1:Number=17, segmenten2:Number=17, segmenten3:Number=17, segmenten4:Number=17, segmenten0:Number=17;

View 4 Replies

ActionScript 3.0 :: Loop For Running Function And Output MovieClips?

Mar 3, 2009

I have a loop that is supposed to run a set of functions and output movieclips on a main movieclip. Each of these smaller movieclip is supposed to be a tile. The code below is supposed to make 50 movieClips each one from a different reference on the tileSheet. However it outputs 50 of the exact same movieclips.

Code:
var tDMax:int = 50;
//Start Get tiles
function getTiles():void{
tList.graphics.beginFill(0x000000);
tList.graphics.drawRect(0, 0,tWidth * 5, tHeight * 10);
[Code].....

Strange enough whatever I made tDMax which is supposed to be the limit for the loop, that's what all the movieclips become. For example if I put it at 25, then all the movieClips become tiles from the bitmap sheet reference # 25. That leads me to think that it's not passing the variable to the functions correctly, and it's only doing it once the loop finishes. But when I trace things like rowT and colT the references to the bitmap are correctly. And when I trade tn within the other functions that's always correct also..

View 2 Replies

ActionScript 3.0 :: Stop Flash Debugger When Code Is Running An Infinite Loop?

Aug 13, 2010

How do you stop the flash debugger if the code is running an infinite loop, or very very slowly?

I put too many trace() statements in, and it is taking forever. I know I can ctrl+alt+delete and stop flash CS5, but is there an easier way?

View 1 Replies

Actionscript 3 :: Set Up A Run / Game Loop In Flash?

Feb 24, 2010

Currently, I have all my variable initialization and function definitions in the timeline's first frame, my logic in the second frame, and a command to 'go to the second frame' in the third frame.

View 1 Replies

ActionScript 3.0 :: Game Loop - Rounding Causes Inaccuracy

Apr 26, 2010

For my game, I've made an easy-to-use instruction list to program enemies. It works pretty well, except it's inaccurate, and the only reason I can think of is a rounding error.

Here's how my instruction list works:
list[0] = "Right:60";
list[1] = "Left:60";

The game loop calls a function on the object that decides what action to do. Right:60 means it moves right for 60 game loops, then goes to the next item on the list. This works fine, except for the inaccuracy. An object gets his xSpeed altered every game loop, depending on the current instruction. If it's "Right", xSpeed += acceleration, if it's "Left", xSpeed -= acceleration.

The game loop itself multiplies the xSpeed by a friction variable, which is 0.7 (may be changed later, currently this works best). Now what happens is, the object bounces back and forth just fine. But it after so many times it keeps going a couple of pixels further to the left than to the right. Eventually, the object falls off the screen on the left, while the instruction says it should do 60 game loops of "Left" and 60 loops of "Right".

View 1 Replies

ActionScript 3.0 :: Turn Base Board Game - While Loop

Mar 15, 2009

I am trying to create a turn base board game. It has four player and out the the four players one is human and the rest are cpu's. The players are number 1,2..4. In the beginning of the game it ask's the user to which player will be the human player. A random number generator function picks a random number between 1-4 and that number player will go first.

There is a while loop that controls the game play something like:
var isNotEndofGame:Boolean = true;
var human:Number; //the user inputs this number.
var aPlayer:Number = getRandomNumber(1,4); //players: 1, 2, 3, 4
while(isNotEndofGame) {
if(aPlayer==human) doHumanMove();
else doCpuMove();

This reset's the player so they can keep on playing until game ends.
if(aPlayer==4) aPlayer = 1;
}
inside function doCpuMove() and doHumanMove() isNotEndofGame will become false when the game objective is met.

The problem I am having is when its the human players turn I want the loop to pause or wait so that the human player can do some interaction such as click a button or drag a movieClip. I tried adding adding mouseclick event listeners and timer neither worked.

View 1 Replies

ActionScript 3 :: Refactoring Automatic Game Loop Into Controlled One

Aug 5, 2010

I need to take control of how my base game class updates:
package {
import flash.display.Sprite;
import flash.events.KeyboardEvent;
public class Test extends Sprite {
private var sprite:Sprite;
[Code] .....

Here after every key press/release AS3 takes care of automatically drawing a sprite onto screen, but I need to do this manualy. Haw to get my hands on updating mechanism here? I need something like this - all time repeating game loop that is set to be updated/redrawn every time at its end.

View 2 Replies

Actionscript 3 :: Write Code For Flash Game Loop?

May 28, 2011

Im making a transition from Java to Flash/Actionscript and Im having sort of a hard time figuring out where to write my code for my flash game loop(or engine) due to flash having "frames" unlike Java.Am I able to put the loop inside the Document class even having like game menus in the game? I havent found a way to put it in there without it always running when the flash application begins.Or should I just have the game loop called every frame? For instance, frame 4 will be level 1 and so the engine will be called out there. And frame 5 will be level 2 and ill call a different instance of the game engine there.Im just having a difficult time due to the "frames". So where would be the best place to put the game loop?

View 4 Replies

Haxe/Flash Game Loop Slow Down Over Time?

Mar 29, 2012

I have a game loop written in Haxe/Flash. For some reason it slows down over time. At first it runs reasonably, but my laptop fan starts spinning up and it gets slower and slower. Why would this happen?

import flash.display.StageDisplayState;
import flash.display.StageScaleMode;
import flash.display.MovieClip;

[code].....

View 1 Replies

ActionScript 3.0 :: Game Loop - Detecting When Object Hits MovieClip

Jul 17, 2010

I'm trying to program this code:
public function enemiesDie(){
enemyLoop: for (var k:int = enemies.length -1;k>= 0; k--){
bulletLoop: for (var i:int = bullets.length -1; i>=0; i--){
if (enemies[k].hitTestObject(bullets[i])){
trace("hit");
[Code] ....

To detect when a bullet hits an enemy in a game I'm trying to make and I get this error:
TypeError: Error #1006: hitTestObject is not a function.
at Space_Hooligans/enemiesDie()
at Space_Hooligans/gameLoop()

View 2 Replies

ActionScript 3.0 :: Make A Simple Game Loop Using Delta Time?

Jan 14, 2012

I have looked everywhere for an example or tutorial on a delta time game loop in AS3. I found many fixed time step examples but very little helpful information on delta time game loops and how it works. I have seen examples that do the calculations in a timer and also seen examples that do the calculations inside the enter_frame event. All the examples I have seen are also incomplete and only provided me with bits and pieces.

View 3 Replies

Professional :: Exe Projector Running Slow While Swf Running Fine?

Mar 19, 2012

I have a strange problem. When I run an exe projector that I exported from flash cs5.5, and on few of my client's computers it running very slow in full screen.When I running an swf file (not exe projector), also in full screen, it running well!I checked my clients computer hardware, and it match the system requirements of flash player.

View 3 Replies

IDE :: Site Is Running Inside The Dreamweaver But When I Publish, It Is Not Running?

May 11, 2009

I have a problem in Flash Site uploading.That is, i have created a flash site & in the dreamweaver i inserted the flash site as insert -> media -> Shockwave.The site is running inside the dreamweaver but when i publish it, flashsite is not running.

View 2 Replies

ActionScript 2.0 :: Use LoadMovie Function Inside Loop To Load External PNG Files / When Game Is Loaded

Jan 19, 2009

I'm trying to use a loadMovie function inside a loop to load external PNG files when my game is loaded. Unfortunately, I can't get even a single loadMovie to work correctly, much less execute a bunch of them.The code is on the root time line, and is targetting an empty movie clip that is nested inside about 3 levels. There is a button, with a movie clip on it, and the empty clip I'm trying to load into on that.so the full target path is myBox_00.smallBox.myLogo(myBox_00 is the button, smallBox is the movie clip, and myLogo is the empty)[code].I even tried using a JPG image instead of a PNG and still no luck. The best I could do was number 4; and that didn't work, all it did was SOMETHING instead of NOTHING... unfortunately that something was to make the button (myBox_00) disappear entirely T_T.I've never had much luck with loading external images. What am I missing here?

View 9 Replies

Actionscript 3 - "game" Loop In Flash Virtual Pond?

Jul 5, 2011

i am having trouble on designing the "game" loop in my flash as3 virtual pond currently i have the following enter_frame loop. in my "pond" parent container, there will be arbitrary amount of "fish" objects and "food pellet" objects. currently in my loop function when two or more food is placed in near distance of the fish , the fish will not move does anyone know why this happens? the below code is in my "Fish" class, updatePosition() merely tells the fish to swim around like a fish.

public function loop(e:Event):void
{
//getDistance(this.x - i.x, this.y - i.y)

[code]....

View 1 Replies

Android :: Cross Platform Game - IOS : Develop A Very Simple Game For Iphone/ipad?

Mar 7, 2012

I am going to develop a very simple game for android and for iphone/ipad I have the option to develop it in cocos2d or in adobe flash air (i am not a developer, but i have 2 developers who are offering me the service)I have a developer that states that cocos2d is better and other one that states that adobe flash air.I want it in cross platform.the cost offered by both developers is the same..i have heard that adobe air has the flaw that it is very slow, is this real? if you had the 2 options which will you use to develop your game and why?

View 1 Replies

ActionScript 3.0 :: Game That Populates User-designed Cards Into The Game Using An External Xml File

Apr 24, 2011

I'm making a game that populates user-designed cards into the game using an external xml file. My main class loads the xml file and then calls to the "Card" class, which wants to use the xml file. I've tried using this.parent and it just gives me a null object reference error. This is what I have so far: Main.as

[Code]...

View 2 Replies

ActionScript 3.0 :: Making Game And Objects Would Spawn At Random And Be Able To Click But When De Game Starts Itself

Jul 4, 2010

currently i making this game and objects would spawn at random and be able to click but when de game starts itself, the spawn is correct but i am unable to make it stop when time goes to 0seconds.

View 1 Replies

ActionScript 3.0 :: Flash - Writing A Simple Game Rule For A Platform Game?

Feb 28, 2011

I'm creating a game at the moment for my university course and it involves the player character jumping on top of boxs twice to break them as opposed to just once.What would be the most efficient/simple way of writing this in Actionscript 3.

View 1 Replies

ActionScript 3.0 :: Mahjong - Levels Of Blocks In Game - Layouts Of The Game Should Be Predefined Or They Should Be Dynamically Created?

Aug 3, 2011

I have recently started working with Mahjong game. But being not so experienced developer. I am just confuse about many aspects of it. So if anyone could throw some light on it. I have to build the game where there could be different number of tiles on screen. 32, 48, 64 , 80, 96, 112 and so on Now I have questions regarding the levels of blocks in this game. I mean the layouts of the game should be predefined or they should be dynamically created? Also I wanted to know how the surface of enable and disable symbols are created?

View 2 Replies

ActionScript 3.0 :: Make A Game, And The Character Inside The Game Could Swim

Jun 13, 2009

I was trying to make a game, and the character inside the game could swim. However, I only wanted him to swim in short bursts that refueled every time he hit the ground.

View 9 Replies

ActionScript 3.0 :: Making A Game Like Pokemon Trading Card Game?

Jul 23, 2010

im trying hard to make a Game like the Pokemon TCG .

View 2 Replies

Flex :: 2d Game Engine For Race Game Built To Webpage?

Nov 19, 2009

I think Flash/Flex is a good aproach for this case.We need to build some like the following

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved