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
Similar Posts:
Mar 14, 2008
I am playing around with the Vertical Shooter by Ernesto Quezada aka _Bruno
link on kirupa: http:[url]....
how can I pause the game.I added a button, but I need the right coding in AS2
View 1 Replies
Jun 25, 2006
i am busy with an project for school. it has to be finished before the 3th of july. i am trying to build a game in flash 8 pro. namely a "fishing game". only the user can fish for bottle of beer or what ever. the thing is, i have a art picture of an lake and i want the bottles to stream through the lake. sie link for picture: the user has an fishing handle each time the user catshes someting the score go's up. the question is: how to do the thing with the bottles. how can i get them to stream down the lake.
View 4 Replies
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
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
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
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
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
May 15, 2011
I watched some videos on youtube, they are good but not in depth. Are there any good, easy to understand resources that how to use the virtual camera?
View 1 Replies
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
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
Aug 14, 2009
im trying to make a virtual keyboard using flash. im using keyCodes, problem is how do you do a backspace?
Code:
if (Key.getCode() == 65) {
var_text.text = var_text.text + "a";
}
the code above should display "a" in a dynamic text box when you press "a" but how about backspace? I thought that the code below would work but it deletes the whole entry rather than a character.
Code:
if (Key.getCode() == 8) {
var_text.text = var_text.text - "";
}
View 3 Replies
Jun 2, 2010
I'm working with a rather large flash file and I've already been to the flash website to download all the updates that deal with large file issues. Things are much better now. However, I was having issues with flash coming back and telling me that my virtual memory was low. I adjusted it and now I'm not getting that error anymore. Now every hour or so flash will just quit. I'll be working and then it will be gone. I don't have a lot of ram on my pc.. 2GB. I'm thinking I'll upgrade it to 4 tomorrow. I'm working
WinXP service pack 3
Intel Pentium D CPU 3.00GHz
2 GB of RAM Video Card: ATI Radeon X1050
View 1 Replies
Dec 17, 2003
I want to create a Flash version of a Virtual pet.I need to generate a level of health , hunger , boredom but im not to sure how about in implementing this.
I�m thinking of using the �maths.random� function to generate a random level of each but im not to sure if this is the best way of doing it (and how to use it)
Would it be better if I just set a value for each and then decrement X amount every so often?
View 5 Replies
Feb 26, 2008
I have file virtual keyboard by javascript. HTML forms worked fine, I have a problem with communication with flash forms. How to load on flash.
View 2 Replies
Dec 17, 2003
I want to create a Flash version of a Virtual pet.
I need to generate a level of health , hunger , boredom but im not to sure how about in implementing this.
Im thinking of using the maths.random function to generate a random level of each but im not to sure if this is the best way of doing it (and how to use it)
Would it be better if I just set a value for each and then decrement X amount every so often?
View 5 Replies
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
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
Jul 25, 2011
I have to decide whether I should choose a Flash or a HTML5 presentation tier third party application for displaying virtual tours. The thing is: The Flash app is better, but doesn't work one iPad. Which do you think I should go for? Flash, high quality or HTML5, a little worst quality?
View 3 Replies
Aug 30, 2011
I have a website setup in IIS 7.5 with a virtual directory pointing to a local folder outside of the www root of my website e.g:
the website is c:website
the virtual directory is in c:images
I use flowplayer to play my movies, when I put the movie path in my website root directory structure, say c:websitemoviesa.flv it works fine in the player, but if I put them inside the virtual directory and point the player to play it from there using a relative URL, it doesn't work
I suspect that this has to do with either permissions or flash configurations to allow it to access directories outside of the scope of the website, but I have no idea where to edit such settings
View 1 Replies
Jan 29, 2012
I've used third party software to create virtual tour for my clients website. It works perfectly fine on its own, you can see it here [URL]
But Once I include virtual_tour.html page on my index page it doesn't work, you can see it here [URL]
I'm confident that I changed all paths to files correctly, but still it doesn't work. However I can see Gray box that should contain virtual tour, but it doesn't display it
View 1 Replies
Jul 6, 2010
Is it possible to make code in actionscript-3 to parse the virtual directories that are constructed in the flash library? I mean that if i add a folder on the library of CS4 called 'graphics' can i write code that parse the elements of that folder in order to fill an array with folder's elements(which are BitmapData classes) ?
View 1 Replies
Sep 10, 2010
I want to make a virtual tour of a room in Flash / Flex. How can this be achieved? Firstly, is it enough to have pictures taken from a still point? If yes, how can I turn them into a real tour? Also, is there a library for this kind of thing for AS3?
View 1 Replies
Jan 31, 2011
I've heard there is a package of software that allows you to create virtual URL's for a flash website.for example: mysite.com/contact -> maps to code in AS3 that chooses the contact page in the site.I think it also works 2-ways so that when the contact info is shown in the flash site, the URL in the browser's address bar also changes.
View 2 Replies
Jul 18, 2010
For the past two months I have been developing a new kind of Flash chat that allows you to fly around in a 2D virtual room with an animated graphical avatar. You can also upload your own picture for an avatar. The special thing about this chat is that it works with MySQL and PHP, so no fancy servers are needed. It can easily be customized in terms of design. Switch out the background image and the avatar icons and you have a completely new chat room. Flash AS3 Avatar Chat v0.94 BETA.
View 2 Replies
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
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
Dec 14, 2011
I am thinking of developing of a game like this: [URL]... Do you have any idea - by which game engine I may develop this type of games? I am not sure whether I have to use any 3d physics engine? I think JiglibFlash may be useful, but I am not sure.
View 1 Replies
Apr 1, 2011
how to make a game tutorial as farmville game tutorial to teach the user to play the game. i have recently involve in make that kind of game tutorial for its user by actionscript 3
View 1 Replies
Feb 15, 2010
When game page loading , the flash game itself does not appear ( just white area as the holder of the flash game) untill the game almost finish downloading, then it appears .. This long waiting with just white area makes visitors leave, thinking there was nothing there.
View 1 Replies