Slow Sprites
Continued from: "
Cannot
embed multiple swfs using swfObject 2"
The site referenced is @ http://www.l4dt.com/
If you go to
http://www.l4dt.com/ you'll see the
"boomer" swf to the right. As more green sprites emerge from his
mouth. Both the header rotating swf and the boomer swf slow. Why is
this?
The sprites start fine, then as more occupy the screen at one
shared time, everything gets slow, but there aren't even that many
sprites!! lol. You'll see.
Is a possible solution to export this animation to After
Effects and render it multiple times in the name of compression?
I figured this is how Adobe gets their big show off
animations to run so smoothly, regardless there is surly a way to
get my swfs running smoothly.
The boomer is constructed from three files:
Boomer.fla -
http://www.l4dt.com/boomer.fla
Bommer.fla's document class,
PxlFountain.as(courtesy of
http://www.pxl.dk/flash/004.php)
http://www.l4dt.com/PxlFountain.as
GlowParticle.as -
http://www.l4dt.com/GlowParticle.as
Boomer.fla bares no actionscript, although I need to know how
to position him above the spawning sprites(something I'll need to
know for the Poster App as well).
PxlFountain.as:
package {
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.utils.Timer;
import flash.events.TimerEvent;
import GlowParticle;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import boomer;
public class PxlFountain extends Sprite {
//Properties
private var _fountainTimer:Timer;
private var _timerInterval:Number;
private var _particleVelocity:Number;
//Constructor
public function PxlFountain(timerInt:Number = 150,
particleVel:Number = -2) {
//Set stage
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
//Set properties
_timerInterval = timerInt;
_particleVelocity = particleVel;
//Create timer
_fountainTimer = new Timer(_timerInterval, 80);
_fountainTimer.addEventListener(TimerEvent.TIMER,
spawnParticle);
_fountainTimer.start();
//Create a new glow particle with random velocity
private function spawnParticle(event:TimerEvent):void {
var randomParticleVelocity:Number = (_particleVelocity *
Math.random()) -2;
var particle:GlowParticle = new
GlowParticle(randomParticleVelocity);
addChild(particle);
GlowParticle.as:
package
import flash.display.Sprite;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.display.Shape;
import flash.filters.GlowFilter;
public class GlowParticle extends Sprite {
//Properties
private var _particle:Shape;
private var _particleTimer:Timer;
private var _particleVelocity:Number;
private var _particleLifespan:Number;
private var _xPos:Number;
private var _yPos:Number;
private var _radius:Number;
private var _gravity:Number;
private var _vx:Number;
private var _vy:Number;
//Constructor
public function GlowParticle(particleVel:Number) {
//Set properties
_particle = new Shape();
_particleVelocity = particleVel;
_particleLifespan = 0;
_radius = 10 * Math.random();
_gravity = .7;
_xPos = 860;
_yPos = 60;
_vx = (Math.random() * 2 -2.4)*9;
_vy = particleVel;
//Set timer for movement and lifespan count
_particleTimer = new Timer(30);
_particleTimer.addEventListener(TimerEvent.TIMER,
moveParticle);
_particleTimer.start();
//Calculate vectors, set new position and call draw method.
Or respawn particle.
private function moveParticle(event:TimerEvent):void {
if(_particleLifespan < 300) {
_vy += _gravity;
_yPos += _vy;
_xPos += _vx;
_particleLifespan++;
drawParticle();
else{
respawnParticle();
//Draw the particle and set filter
private function drawParticle():void {
_particle.graphics.clear();
_particle.graphics.lineStyle(4, 0x455b00, 1);
_particle.graphics.drawCircle(_xPos,_yPos,_radius);
_particle.filters = [new GlowFilter(0x5d7c00,1,6,6,2,3)];
addChild(_particle);
//Respawn the particle
private function respawnParticle():void {
_particleLifespan = 0;
_xPos = 860;
_yPos = 60;
_vx = (Math.random() * 2 -2.4)*9;
_vy = _particleVelocity;
The swf is being inserted into
Worpress 2.7 footer.php. My
Wordpress engine has 14 plugins installed and activated( I plan to
go in to each plugin's code along with Wordpress' and optimize it
soon). Is Wordpress a possible suspect for the slowness?
Boomer.fla's dimensions are 950 pixels in width and 625
pixels in height. I'd rather Boomer.fla only be 605x196 and set
noscale and 100%x100% in hopes of the sprites reaching the user's
whole screen, but they always cut off at the FLAs
dimensions.
i don't think fp10 is faster. if anything, it's probably
slower but you could test and let us know.
to ready an object for gc you must remove it from the display
list and remove all references to the object. search this forum or
use google to search for some specifics.
Similar Messages
-
Flash sprite in Director: slow, slow!
It's not a new problem but maybe there's a new solution?...
I have a Flash game in a Director projector. The Flash games
works fine by itself (not embedded in Director), but inside
Director, everything runs much slower. Is there any ways to speed
things up?
Thanks
SergeYea Flash tends to run a bit slower in director, be sure the
default
direct to stage flash member property is set.
Mx 2004 has an updated flash xtra that runs a little more
effeciently,
with an option to run multiple flash sprites in the same
memory space.
There's a downloadable director update for flash 8.0 -
Subpixel drawing of slow-moving sprites
Hi.
I've been working on an iOS game with Flash for a while. Now I'm stuck with a display problem.
My game objects move very slowly and steadily and I notice pretty bad jittering/stuttering. This is GPU mode in Air 2.7, CPU mode is too slow. The cause of the jittering seems to be that Air moves my sprites (based on PNGs) only in full- and half-pixel steps, regardless of whether cacheAsBitmap/-Matrix are enabled. Is this an optimization by Adobe or can I get rid of this somehow? It's really annoying.
Thank you!Thank you for your answers.
I'm currently only developing a low-res (iPhone 3GS) prototype, so I can't say how it will look on iPhone 4.
No caching at all or cacheAsBitmap + -Matrix both look the same: the very discernible half-pixel stepping effect.
Just cacheAsBitmap looks much worse as it produces full-pixel stepping.
I also tried using a larger Matrix and larger, down-scaled PNGs, but that didn't help either, unfortunately.
Positions of the sprites are all Numbers with no rounding. On the desktop in Flash player (with no caching), this produces beautiful fluid motions, but on the iPhone, it still snaps to half-pixels. That's why I was wondering if that was an optimization in Air. -
Troulble slowing down sprite animations
Hi guys! Well, I looked all over but couldn't find an answer. What I want to do is slow down the animation of a sprite. I have a working sprite class called AnimationSprite that loops through an array of images when it updates. The problem is that when my soon-to-be game is running at its frame rate (approx. 32) the "Animation Sprites" are looping through their animations too fast. I couldn't really think of a way to set a delay on their animations. I thought of using a Timer to run a TimerTask that increases the sprites' current frame at a sertain rate. Is this a good idea? Also, does GAGE run on Mac OS X? When I download it it just unzips an empty folder that doesn't contain any data.
Anyways,
Thanks for your time.static final ANIMATION_DELAY = 200;
static final ANIMATION_FRAMES = 32;
int counter = 0;
//your animation loop
g.drawImage(animFrame[(counter*ANIMATION_FRAMES)/ANIMATION_DELAY],x,y,null);
if(++counter==ANIMATION_DELAY) counter=0; -
Animating Sprites the slow poke approach...
Hi there, I've got a small application which features small creatures controlled by some fearsome AI dashing around a randomly generated environment trying to kill each other. (it's somewhat more complex than that, but you get the gist). Rather than do the sensible thing and look for examples of Sprite animation, I just got stuck in, thinking, what the hell, I'll give it a shot. This is what I came up with....
AnimationCanvas class extends JComponent, this is where all the animation stuff is drawn.
SpriteManager class, contains a vector of all the sprites and is responsible for updates
abstract Sprite class, provides an extensible template for sprites, I've got things like TreeSprite and RockSprite. Some of the sprites are composite sprites, comprising of several images which are overlapped slightly, an example of this is my AgentSprite it requires a total of 52 images, I load these using a MediaTracker when the object is instanciated before the app is displayed. They are all small images, less than 1k. The animation is done through the use of a Swing Timer which repaints the scene after a delay of 1000/24 ms, which I assume gives me 24fps ( is there a way of checking the fps? ) the AI portion of the app. updates the position of the sprites via the SpriteManager and also tells the Sprite what images to use. This works sweet on Win XP with my 2Ghz machine, but the target was to have it run on anything that runs Java 1.4 +. Running it under Linux on a PIII 500 for example is like watching paint dry. Great! Soooo I can only assume it is my inept implementation that is causing the problem, I have had a little look around and have seen a few people just using a single image with many sprites on it, using a PixelGrabber to get the desired bits, is this a more efficient method? Or does pre-loading the images with a MediaTracker do a better job? Or should a time my animation a different way? I would appreciate it if you could give me a tip or two.... I'm happy to post code snippets, but there's a fair ammount, specific bits might be easier... or if some of you are particularly adventurous i can put the source code up on the net for you to d/l and have a little look at :-)
Cheers,
TomMy source code, images and pre compiled classes are now available here...
http://www.macs.hw.ac.uk/~ceetfc/ait/ait.zip -
Performance and Sprite objects
I've written an application in Flex 2 that consists of
several accordions containing custom canvas objects, and it is
having performance problems.
I'm running the application within IE 6.0 under Windows 2000.
The application loads an XML file and uses the data to create
custom Sprite objects in the canvases. Each Sprite consists of two
swf images that are loaded using the Loader class, a small
rectangle created by using the Sprite graphics property, and a text
label. In addition, each Sprite is connected to one or more other
Sprites by a line drawn using the Sprite's graphics property. The
Sprites have the capability for being dragged, and for being
highlighted when clicked.
My problem is performance; these Sprites perform slower than
a similiar program that I wrote in ActionScript 2.0. From what I
understand, Flex 2.0, ActionScript 3.0, Flash 9, and the new Sprite
class are supposed to deliver greatly improved performance, but my
new application seems worse than the old one under Flash 7 using
MovieClips. The more Sprites on the screen, the worse the
performance, and the lines seem to contribute to the degradation.
There is way too much code involved to include in this
message, so I'm looking for general info. Is there some basic point
I am missing?
The performance is also degraded when triggering instances of
the Menu and Popup classes. When running the Task Manager during
the application, I've noticed that both Memory Usage and GDI
objects increase whenever I display a Menu or Popup. Both Memory
Usage and GDI objects go up and down, but there is a steady
increase in both metrics as I continue to use Menus and Popups. As
far as I can tell, I am disposing of both types of objects
properly, but it appears that their allocation is remaining in
memory.I've written an application in Flex 2 that consists of
several accordions containing custom canvas objects, and it is
having performance problems.
I'm running the application within IE 6.0 under Windows 2000.
The application loads an XML file and uses the data to create
custom Sprite objects in the canvases. Each Sprite consists of two
swf images that are loaded using the Loader class, a small
rectangle created by using the Sprite graphics property, and a text
label. In addition, each Sprite is connected to one or more other
Sprites by a line drawn using the Sprite's graphics property. The
Sprites have the capability for being dragged, and for being
highlighted when clicked.
My problem is performance; these Sprites perform slower than
a similiar program that I wrote in ActionScript 2.0. From what I
understand, Flex 2.0, ActionScript 3.0, Flash 9, and the new Sprite
class are supposed to deliver greatly improved performance, but my
new application seems worse than the old one under Flash 7 using
MovieClips. The more Sprites on the screen, the worse the
performance, and the lines seem to contribute to the degradation.
There is way too much code involved to include in this
message, so I'm looking for general info. Is there some basic point
I am missing?
The performance is also degraded when triggering instances of
the Menu and Popup classes. When running the Task Manager during
the application, I've noticed that both Memory Usage and GDI
objects increase whenever I display a Menu or Popup. Both Memory
Usage and GDI objects go up and down, but there is a steady
increase in both metrics as I continue to use Menus and Popups. As
far as I can tell, I am disposing of both types of objects
properly, but it appears that their allocation is remaining in
memory. -
Hi Everyone!
I have been a lurker here, learning from reading other's posts. I am in serious need of help, as I have been struggling with this issue for over a week and I can't move forward to other things until I get it resolved...
Here's what's up: I am creating a single-page website as a landing page for a product I offer. (These are very common now in product marketing). The page is here: http://www.howtogetamazingrelationships.com.
The page that is there is about the 4th iteration of the page in the quest for a faster-loading page. Everytime I test it - no matter what I do - it ends up being about a 24 second load time. Here's a sample test for review: http://tools.pingdom.com/?url=howtogetamazingrelationships.com&treeview=0&column =objectID&order=1&type=0&save=true
Here are the things I have done to try to speed this baby up:
1. Took my youtube video off auto-play.
2. Optimized the site using Web Site Maestro. 27% decrease in size; no load time difference.
3. Took out shapes and graphics.
4. Rebuilt the site on a blank template - now it is actually a little worse!
5. Took out the website.js file - totally messed things up.
6. Eliminated the navigation.
Nothing is even showing the least bit of difference in speed...and it is driving me crazy.
Here's the thing - I have also contacted Web Site Maestro's support for help, and they said that the problem was the size of the site and the length of the page. But here's the thing - I checked the load speed of a page that is about double my page size and length, and it loads in like 4 seconds: http://tools.pingdom.com/?url=http://www.wealthbeyondreason.com/page2.php&treevi ew=0&column=objectID&order=1&type=0&save=true
Anyone have help/advice for me? I am so frustrated with this, as the iWeb is crazy-easy to build, but I can't have a simple one-page product page load that slow. No one is going to stay around for 24 seconds!
I just am at the end up my rope and don't know anything else to do. I really don't want to rebuild the site again and still not see results, so any help would be hugely appreciated.
Thanks so much in advance, and I hope you are all having a beautiful day -
:o) TaraOkay, more info -
I checked my site on a different web analyzer, and it does seem to be loading quickly - 15.66 seconds for a 56 k, but only 3.6 for T1. So that is good -
One thing I noticed in the recommendations is that there are 6 scripts that are running, that can slow things down. I don't really know how to change that (I am pretty web-savvy, but far from a developer) Here's what they recommended on the page -
Analysis and Recommendations from webanalyzer.com:
TOTAL_OBJECTS - Caution. You have 18 total objects on this page. From 12 to 20 objects per page, the latency due to object overhead makes up from 75% to 80% of the delay of the average web page. See Figure II-3: Relative distribution of latency components showing that object overhead dominates web page latency in Website Optimization Secrets for more details. Consider reducing, eliminating, and combining external objects (graphics, CSS, JavaScript, iFrames and XHTML) to reduce the total number of objects, and thus separate HTTP requests. Consider using CSS sprites to help consolidate decorative images.
TOTAL_IMAGES - Caution. You have a moderate amount of images on this page (10 ). Consider using fewer images on the site or try reusing the same image in multiple pages to take advantage of caching. Using CSS techniques such as colored backgrounds, borders, or spacing instead of graphic techniques can help reduce HTTP requests.
TOTAL_SCRIPT - Warning! The total number of external script files on this page is 6 , consider reducing this to a more reasonable number. Combine, refactor, and minify to optimize your JavaScript files. Ideally you should have one (or even embed scripts for high-traffic pages) on your pages. Consider suturing JavaScript files together at the server to minimize HTTP requests. Placing external JavaScript files at the bottom of your BODY, and CSS files in the HEAD enables progressive display in XHTML web pages.
HTML_SIZE - Caution. The total size of this HTML file is 60492 bytes, which is above 50K but below 100K. With 50K of images and multimedia this means that your page will load in about 20 seconds. Consider optimizing your HTML and eliminating unnecessary features. To give your users feedback, consider layering your page or using positioning to display useful content within the first two seconds. -
Random movement within an irregularly constrained sprite (EDITED)
(NEW EDIT AT BOTTOM)
So, basically, I'm making a little program that crudely simulates an ant colony. I have little tunnels the ant-sprites can travel down, as well as chambers, in an irregularly-shaped sprite.
I am not the most advanced at Director, but at least I've figured some things out. I found code on an open-source website (openspark, actually) that allows for an object to be dragged inside an irregular shape that has a matte ink.
It's all well and good that the ants can be dragged within this boundary, but is there any way to have them use a Random Movement and Rotation behavior that is confined by the same laws? Or is that impossible / extremely hard?
By the way, I already have a middleman behavior I use to toggle between dragging and random movement, so that does not factor into my question. I just need to know how to alter the Random Movement behavior so that it abides by the same constraint rules as my dragging behavior, if possible.
Here is the code I'm using for dragging. I made a couple edits from the original, but not much.
Don't worry about the canJumpGaps function of this code, as I am using a touch screen and it will never be used.
property spriteNum
property canJumpGaps
-- set to TRUE on mouseDown if the shiftDown
property pSprite
-- this draggable sprite
property pConstraintSprite
-- sprite to which this sprite is constrained
property pConstraintAlpha
-- alpha channel image of constraining member
property pOffset
-- offset between this sprite's loc and the mouse
property pCurrentLoc
-- last known position of this draggable sprite with respect to the constraining sprite
-- EVENT HANDLERS --
on beginSprite(me)
pSprite = sprite(spriteNum)
pConstraintSprite = sprite(1)
-- We'll use the value of the alpha channel to detect holes in the sprite
pConstraintAlpha = pConstraintSprite.member.image.extractAlpha()
end beginSprite
on mouseDown(me)
canJumpGaps = the shiftDown
if not pCurrentLoc then
-- The user has not yet dragged the sprite anywhere. Find out its
-- current position with respect to the constraint sprite.
pCurrentLoc = pConstraintSprite.mapStageToMember(pSprite.loc)
if not pCurrentLoc then
-- The mouse is not over an opaque part of the constraint
-- sprite. It can't be dragged at all.
exit
end if
end if
-- Start dragging
pOffset = pSprite.loc - the mouseLoc
end mouseDown
on exitFrame(me)
if not pOffset then
-- The user is not dragging the sprite
exit
end if
if the mouseDown then
me.mMoveSprite()
else
-- The user just released the mouse
pOffset = 0
end if
end exitFrame
-- PRIVATE METHOD --
on mMoveSprite(me) ---------------------------------------------------
-- SENT BY exitFrame()
-- ACTION: Calculates how near to the current mouseLoc the draggable
-- sprite can be dragged.
tMouseLoc = the mouseLoc + pOffset
-- Find where the mouse is with respect to the constraint member
tImageLoc = pConstraintSprite.mapStageToMember(tMouseLoc)
if voidP(tImageLoc) then
-- The mouse is currently outside the constraint sprite. Use a
-- slower but more powerful method of determining the relative
-- position.
tLeft = pConstraintSprite.left
tTop = pConstraintSprite.top
tImageLoc = tMouseLoc-point(tLeft, tTop)
else if canJumpGaps then
-- Check if the mouse is over a non-white area of the constraint
-- member
tAlpha = pConstraintAlpha.getPixel(tImageLoc, #integer)
end if
if tAlpha then
-- Let the mouse move to this spot
else -- Can't jump gaps or the mouse is over a gap
-- Find how near the dragged sprite can get
tDelta = pCurrentLoc - tImageLoc
tDeltaH = tDelta.locH
tDeltaV = tDelta.locV
tSteps = max(abs(tDeltaH), abs(tDeltaV))
if not tSteps then
-- The mouse hasn't moved since the last exitFrame
exit
end if
tSteps = integer(tSteps)
if float(tSteps) <> 0 then
tStep = tDelta / float(tSteps)
-- This makes sure I'm not dividing by zero.
else
tStep = 1
end if
repeat while tSteps
-- Move one pixel towards the mouse
tSteps = tSteps - 1
tLoc = tImageLoc + (tStep * tSteps)
-- Test that we are still on an opaque area
tAlpha = pConstraintAlpha.getPixel(tLoc, #integer)
if not tAlpha then
-- We've gone a step too far: move back to an opaque area
tSteps = tSteps + 1
exit repeat
end if
end repeat
end if
-- Update the absolute and relative positions of the draggable
-- sprite.
tAdjust = tSteps * tStep
pCurrentLoc = tImageLoc + tAdjust -- relative to constrain sprite
tMouseLoc = tMouseLoc + tAdjust -- relative to the stage
-- Move the sprite
pSprite.loc = tMouseLoc
end mMoveSprite
Thank you SO incredibly much to anyone who can help. This is for a senior project of mine in undergrad, and I really appreciate any help I can get. My resources on Director are limited, especially for odd issues like this.
EDIT:
So I found out that a way to do collision detection in Director is by using getPixel().
I found this protected dcr file that is a perfect example of the way in which I want my ant objects to interact with walls:
http://xfiles.funnygarbage.com/~colinholgate/dcr/irregular.dcr
I've been trying to build a getPixel() collision detection mechanism for hours but have been unsuccessful.
Basically, what I want the behavior to do is... get the pixel color of the tunnel sprite (sprite 2) at the center of the ant sprite. If the pixel color is white (the transparent background color surrounding the tunnel shape), I want to tell the Random Movement and Direction behavior this:
pSprite.pPath = VOID
sendSprite(pSprite, #mNewPath)
pSprite.pRotate = VOID
sendSprite(pSprite, #mNewRotation)
This tells the Random Movement behavior to stop moving and determine a new path. The behavior should probably also offset the center of the sprite by a couple pixels when this happens so it is no longer over an opaque area and the Random Movement behavior won't get stuck.
Will this work? If not, could anyone help me in building a collision detection behavior based on getPixel? This doesn't seem like it'd be all that difficult - at least in theory.Hi Roberto,
I had an experience, which defies most common sense about data modeling. Moving from a cube to a ODS and then back on to a cube to introduce delta on a BPS delta application. It is a long sad disappointing store. But I had 24 keys (I know 16 is the max, I combined 6 keys into a single filed also had the same fileds in the data fileds, use these combination keys to deal with 16 key max limitation and adjusted during transformation.
It did work, but later gave up due to some other functional issues and we realized it is a bad experiement due to everyones data understanding.
I am saying is 16 key limitation is an issue, you can overcome with combining couple of fileds into a single filed in the start routine, map it and reuse it later.
Hope this gives you some ideas.
Goodluck,
Alex (Arthur Samson) -
Spawning multiple instances of a sprite (firing bullets). Help needed.
Hello there. I'm currently trying to make a game in director 11.5 for a University project. I've decided to make a scrolling space shooter but I've run into a problem. Any tutorial I've found has created a limited 'bank' of bullets to fire, only allowing a certain number on the stage at any given time. What I need to do is to leave a single bullet sprite off the boundaries of the page and essentially copy it and it's lingo behaviors to spawn another instance of the bullet on the stage when the player fires (using the left mouse button in this case). I also need this copy to be deleted entirely when it collides with an enemy or leaves the boundaries of the stage, otherwise the game will just run slower and slower as more shots are fired.
I have heard that this is possible using the puppetSprite() method but the API doesn't shine much light on the issue and neither has literally hours of google searches. If anyone can let me know any method of doing this, I'd be very grateful.
On a related issue, when fired the bullet will need to intsect the location of where the mouse cursor was when the bullet was fired and then continue on a linear path. I've worked out a method of doing this but it isn't very effective or efficient (the speed of the bullets would be determined by how far away the mouse cursor is from the players ship and I think there's probably a less calculation intensive method for doing this) and as I can't spawn the bullets as of now, I really don't know if it will even work. If anyone has any advice on how to better implement this mechanic, again I'd welcome your input. Thanks in advance.You want to work with objects not numbers which means using Points for locs and Sprite references and not sprite numbers.
I feel that using a object manager object would make programming this a lot easier, cleaner, and more efficient. Rather than give a lecture on OOP and OOD, I took some of Josh's ideas like using a timeout object and wrote some scripts in my style to give you something else to boggle your brain.
I tested these scripts but not thoroughly and I left plenty for you to do.
I separated out the creation and control of "bullets" from the movement of the bullets. So, there is a behavior that does nothing more than move the bullet sprites and the control object handles everything else using a single timeout object.
I suggest creating a new project to play with these scripts. Throw a bunch of sprites on the stage and attach the "Hitable Sprite" behavior to them, make sure you have a sprite named "bullet", and a " go the frame" behavior to loop on and you should be good to go.
Note that where I set the velocity of the bullet sprites, that I use "100.0" instead of 20. 20 would be a very fast speed.
Here's the Parent script for the control:
-- Bullet Control parent script
property pUpdateTimer -- timeout object for doing updates
property pBullets -- list of bullet sprites
property pGunLoc -- location of the gun, ie the location where your bullets start at.
property pRightBounds -- right edge of the stage
property pBottomBounds -- bottom edge of the state
property pZeroRect -- used for intersection hit detection
on new me
pUpdateTimer = timeout().new("BulletCntrl", 25, #update, me) -- 25 milleseconds = 40 updates per second
pBullets = []
pGunLoc = point(300,550) -- *** SET THIS to where you want your bullets to start at.
pZeroRect = rect(0,0,0,0)
-- store stage bounds for later use
pRightBounds = _movie.stage.rect.width
pBottomBounds = _movie.stage.rect.height
return me
end new
on fire me
NewBullet = script("Bullet behavior").new(pGunLoc) -- create new bullet sprite
if ilk(NewBullet, #sprite) then pBullets.add(NewBullet) -- store sprite reference
end fire
on update me, timeob
if pBullets.count = 0 then exit -- no bullets to update
-- update bullet positions
call(#update, pBullets)
-- get list of sprites to test for hits/collisions
HitSprites = []
sendAllSprites(#areHitable, HitSprites) -- the list "HitSprites" is populated by each hitable sprite.
BulletsToDelete = [] -- list of bullet sprites to delete
-- check if any bullet has hit a hitable sprite
repeat with Bullet in pBullets
repeat with HitSprite in HitSprites
if Bullet.rect.intersect(HitSprite.rect) <> pZeroRect then
HitSprite.explode()
BulletsToDelete.add(bullet)
exit repeat -- leave inner loop
end if
end repeat
end repeat
-- check if bullet is out of bounds
repeat with Bullet in pBullets
Die = false
if Bullet.right < 0 then Die = true
if Bullet.left > pRightBounds then Die = true
if Bullet.top > pBottomBounds then Die = true
if Bullet.bottom < 0 then Die = true
if Die then BulletsToDelete.add(Bullet)
end repeat
-- remove any sprites that hit something or went off the screen
repeat with Bullet in BulletsToDelete
Bullet.die()
pBullets.deleteOne(Bullet) -- remove bullet from list of active bullets
end repeat
end update
on stopMovie
-- end of app cleanup
if pUpdateTimer.objectP then
pUpdateTimer.forget()
pUpdateTimer = void
end if
end
The behavior for the bullets is:
-- Bullet behavior
property pMe
property pVelocity
property pCurLoc
on new me, StartLoc
-- get a sprite
pMe = me.getSprite()
if pMe.voidP then return void -- if not a sprite then give up
-- setup this bullet sprite
pMe.puppet = true
pMe.member = member("bullet")
pMe.loc = StartLoc
pMe.scriptInstanceList.add(me) -- add this behavior to this sprite
-- set velocity
pVelocity = ( _mouse.mouseLoc - StartLoc) / 100.0 -- Note: magic number "20.0"
updateStage() -- need to update pMe.rect values
pCurLoc = pMe.loc -- store current location
return pMe -- Note: returning "pMe" not "me"
end new
on getSprite me
repeat with CurChannel = 1 to the lastchannel
if sprite(CurChannel).member = (member 0 of castLib 0) AND sprite(CurChannel).puppet = false then
return sprite(CurChannel)
end if
end repeat
return void
end getSprite
on update me
-- move bullet.
pCurLoc = pCurLoc + pVelocity -- add velocity to pCurLoc to maintain floating point accuracy
pMe.loc = pCurLoc
end update
on die me
pMe.scriptInstanceList = [] -- must manually clear this property
pMe.puppet = false
end
We setup everything in a Movie script:
-- Movie Script
global gBulletCntrl
on prepareMovie
gBulletCntrl = script("Bullet Control").new()
the mouseDownScript = "gBulletCntrl.fire()" -- route mouseDown events to the global object gBulletCntrl.
end prepareMovie
on stopMovie
the mouseDownScript = ""
end stopMovie
Finally since we are shooting at other sprites we need a script on them to interact with the bullets.
-- Hitable Sprite Behavior
property pMe
on beginSprite me
pMe = sprite(me.spriteNum)
end beginSprite
on enterFrame me
-- movie sprite
end enterFrame
on areHitable me, HitList
HitList.add(pMe)
end areHitable
on explode me
put "Boom"
end explode -
TiledLayers : Slowing Down
I have created a tiled layer (javax.microedition.lcdui.game.TiledLayer) for the purpose of making a World for my sprite to move around in. The game world i want is just a big box with a wall round the outside and grass inside that box. As I increase the size of the tiled layer the application runs slower & slower. Is this because :
(B.T.W -- An instance of LayerManager controls drawing the level)
The application draws the whole tiledlayer (onto the offscreen buffer) but only shows whats appropriate to the view window.
The application calculates which bit of the tiledlayer needs to be drawn to the view window, but as the tiled layer gets larger, the calculations become alot more complex (therefore slowing the app down)
I cant really think of any other way of drawing a large background without slowing down the application. If i use sprites I will end up with 400 of them (One for each tile), and that would slow the application down to miniscule rates( especially when I try to calculate collision detection for about 80 tiles)
This is the code use for constructing a simple level:
*MAIN GAME CLASS
public class Level extends TiledLayer
*Dimension Fields - Constant after intitialisation
/*The width of the square tiles that make up this layer*/
static int TILE_WIDTH = 34;
/*The Height of the square tiles that make up this layer*/
static int TILE_HEIGHT = 34;
/*This gives the number of squares of "texture" to put along
the screen -- Changing this to 10 means a smaller level but faster game*/
static int INITIAL_COLUMNS = 23;
/*This gives the number of squares of "texture" to put along
the screen -- Changing this to 10 means a smaller level but faster game*/
static int INITIAL_HEIGHT = 23;
public Level() throws Exception
super(INITIAL_COLUMNS, INITIAL_HEIGHT, Image.createImage("/icons/Level.png"), TILE_WIDTH, TILE_HEIGHT);
/*Quickly fill some cells*/
fillCells(1, 1, 20, 1, 1);
fillCells(1, 1, 1, 20, 1);
/*sets object position*/
setPosition (0, 0);
void reset()
setPosition (0, 0);
}I didn't see it in your code but I am sure you are using a for(x;x;x) loop to draw the scene.
Yes, your are correct, your slow down is that all of your map is being processed as if it were all going to be drawn to the screen. You have to write the code that avoids this. On your 10x10 you are running the loops 100 times, but when you increase the size to 23 by 23 you are running the loops 529 times every time you have to redraw the scene. The solution is to set up some tracking variables and put them in your loop so we only have to run the loops 81 times, no matter how big the map is.
Something I have been trying lately is drawing all of my layers in one for loop.
map_width = 32; // this is the size of the map
map_height = 32; // not all of the map will fit in the screen
width = 9; // this is the tile size of the screen
height = 9; // 9 tiles wide, 9 tiles high
character_x_possition = (possition x on the map divided by 34 which is your tile width);
character_y_possition = (possition y on the map divided by 34 which is your tile width);
corner_x = character_x_possition - 4; // or 5?, just try it, I can't remember
corner_y = character_y_possition - 4; //or 5 again
for(int x = corner_x; int < corner_x + width; x++)
{ for(int y = corner_y; int < corner_y + height; y++)
Draw layer 1 to backbuffer
if(x == char_possition && y == char_possition)
{ Draw Character to back buffer }
else { Draw layer2 to back buffer}
Draw layer 3 to back buffer
Draw back buffer to screen
//////////// END OF SORT OF CODE :-) /////////////
You can also use something similar to cut out time in colision checking, theres no since in checking the entire scene for colision when there are only 9 possible colisions at a given time, there are also some advanced meathods such as quad trees, but these at the moment are beyond me until I can find the time to sit down and study them. Hopefully some else will post on these, but they be beyond the needs of your game. I breifly read over them and went with the 9 tile checking for my game.
One other note, if this is an rpg, there is rarely benefit for an offscreen NPC to be moving. :-) -
I have a continuing problem with browser pages loading very slow and getting many errors. This happens with both Safari and Firefox, but is worse on Safari.
I have wifi through a cable modem. I've run speedtest.com and have 8-12 mbps, so that's not the problem. I've read all of the posts on the Safari discussions and have deleted files and done resets. Little, if any, improvement.
Here are the stats on my machine:
Machine Name: Mac mini
Machine Model: PowerMac10,2
CPU Type: PowerPC G4 (1.2)
Number Of CPUs: 1
CPU Speed: 1.5 GHz
L2 Cache (per CPU): 512 KB
Memory: 1 GB
Bus Speed: 167 MHz
Boot ROM Version: 4.9.4f1Unfortunately, I can't hook up to the cable modem directly.
Yes, I installed OpenDNS correctly. Firefox is slightly quicker than Safari.
Here's the dump from the Activity window:
http://discussions.apple.com/thread.jspa?messageID=10079571#10079571
http://discussions.apple.com/css/discussions.css
http://discussions.apple.com/global/nav/images/breadcrumb_bg.png
http://discussions.apple.com/global/nav/images/breadcrumb_sep.png
http://discussions.apple.com/global/nav/images/globalnavbg.png
http://discussions.apple.com/global/nav/images/searchfield_repeat.png
http://discussions.apple.com/global/nav/images/spinner.gif
http://discussions.apple.com/global/nav/scripts/shortcuts.js
http://discussions.apple.com/global/nav/styles/nav.css
http://discussions.apple.com/global/styles/base.css
http://discussions.apple.com/images/arrow-left-16x16.gif
http://discussions.apple.com/images/bottom.gif
http://discussions.apple.com/images/bottom_rightcap.gif
http://discussions.apple.com/images/bottomline.gif
http://discussions.apple.com/images/contentshadow.gif
http://discussions.apple.com/images/header.gif
http://discussions.apple.com/images/header_rightcap.gif
http://discussions.apple.com/images/headertitle.gif
http://discussions.apple.com/images/leftside.gif
http://discussions.apple.com/images/mail-16x16.gif
http://discussions.apple.com/images/paginationbottom.gif
http://discussions.apple.com/images/paginationtop.gif
http://discussions.apple.com/images/permlink-16x16.gif
http://discussions.apple.com/images/question-possibly_resolved-24x24.gif
http://discussions.apple.com/images/reply-16x16.gif
http://discussions.apple.com/images/rss-27x15.gif
http://discussions.apple.com/images/sb-help.gif
http://discussions.apple.com/images/sb-login.gif
http://discussions.apple.com/images/sb-prefs.gif
http://discussions.apple.com/images/sbmodulebody.gif
http://discussions.apple.com/images/sbmoduletop.gif
http://discussions.apple.com/images/searchbg20050513.gif
http://discussions.apple.com/images/searchleftcap20050513.gif
http://discussions.apple.com/images/searchrightcap20050513.gif
http://discussions.apple.com/images/sidebar.gif
http://discussions.apple.com/images/sidebarshadow.gif
http://discussions.apple.com/images/status/ball-03.gif
http://discussions.apple.com/images/status/ball-04.gif
http://discussions.apple.com/images/up-10x10.gif
http://discussions.apple.com/thread.jspa?messageID=10079571#10079571
http://images.apple.com/global/metrics/js/scodeh.js
http://metrics.apple.com/b/ss/appleglobal,applesupport/1/H.20.3/s39111388027668? AQB=1&vvpr=true&&ndh=1&t=30/7/2009%2010%3A40%3A6%200%20420&pageName=%20slow%20in ternet%20...discussions%20/%20mac%20mini%20%28previous%20to%20early%202009%29%20 /%20internet%20%26amp%3B%20networking%20the%20mac%20mini%20/%20&g=http%3A//discu ssions.apple.com/thread.jspa%3FmessageID%3D10079571%2310079571&cc=USD&vvp=DFA%23 1513429%3Av46%3D%5B%5B%22DFA-%22%2Blis%2B%22-%22%2Blip%2B%22-%22%2Blastimp%2B%22 -%22%2Blastimptime%2B%22-%22%2Blcs%2B%22-%22%2Blcp%2B%22-%22%2Blastclk%2B%22-%22 %2Blastclktime%5D%5D&ch=www.us.support&c1=discussions&c2=Discussions%20/%20Mac%2 0mini%20%28previous%20to%20early%202009%29%20/%20Internet%20%26amp%3B%20Networki ng%20the%20Mac%20mini%20/%20&c4=http%3A//discussions.apple.com/thread.jspa&c5=ma cppc&c6=%3A%20%20slow%20internet%20...discussions%20/%20mac%20mini%20%28previous %20to%20early%202009%29%20/%20internet%20%26amp%3B%20networking%20the%20mac%20mi ni%20/%20&c9=10.4.x&c15=No%20Zip&c18=QuickTime%20Not%20Detected&c19=Flash%2010&c 20=non-store%20kiosk&c43=QuickTime%20Not%20Detected&c44=appleglobal%2Capplesuppo rt&c50=support%3D7&s=1024x768&c=24&j=1.6&v=Y&k=Y&bw=1020&bh=658&p=QuickTime%20Pl ug-in%207.6.2%3BQuickTime%20Plug-In%207.6.2%3BJava%20Plug-in%3BAdobe%20Acrobat%2 0and%20Reader%20Plug-in%3BRealPlayer%20Plugin.plugin%3BQuartz%20Composer%20Plug- In%3BVerified%20Download%20Plugin%3BJava%20Plug-in%20for%20Cocoa%3BShockwave%20F lash%3BPhotoCenterPlugin1.1.2.2%3BFlip4Mac%20Windows%20Media%20Plugin%202.2.3%3B MoveNetworks%20Quantum%20Media%20Player%3BFlip4Mac%20Windows%20Media%20Web%20Plu gin%202.2.3%3BSilverlight%20Plug-In%3BCoupons%20Inc.%2C%20Mac%20Safari%20Coupon% 20Printer%20Manager%3BShockwave%20for%20Director%3BUnity%20Player%3B&AQE=1&A2S=1 /respcamphist;src=1513429;ec=nh;rch=2;lastimp=0;lastimptime=0;lis=0;lip=0;lic=0; lir=0;lirv=0;likv=0;lipn=;lastclk=0;lastclktime=0;lcs=0;lcp=0;lcc=0;lcr=0;lcrv=0 ;lckv=0;lcpn=;ord=1251654008
http://www0.info.apple.com/images/favicon.ico
http://www.linkedin.com/groupAnswers?viewQuestions=&gid=1806481&forumID=3&sik=12 51654122855&goback=%2Eanh_1806481
about:blank
about:blank
http://b.scorecardresearch.com/b2?c1=2&c2=6402952&rn=0.835469612153247&c7=http%3 A//www.linkedin.com/groupAnswers%3FviewQuestions%3D%26gid%3D1806481%26forumID%3D 3%26sik%3D1251654122855%26goback%3D%252Eanh1806481&c3=&c4=&c5=&c6=&c15=&c16=&c8=Discussions%20%7C%20LinkedIn&c9=http%3A//ww w.linkedin.com/groupAnswers%3FviewQuestionAndAnswers%3D%26gid%3D1806481%26discus sionID%3D6408805%26goback%3D%252Eanh1806481&cv=1.6
http://b.scorecardresearch.com/beacon.js
http://edge.quantserve.com/quant.js
http://media.linkedin.com/mpr/mpr/shrink4040/p/1/000/005/13d/0c797a4.jpg
http://media.linkedin.com/mpr/mpr/shrink4040/p/1/000/006/135/1a2b21a.jpg
http://media.linkedin.com/mpr/mpr/shrink40_40/p/1/000/016/0fa/13e780e.jpg?goback=%2Eanh1806481
http://media.linkedin.com/mpr/mpr/shrink4040/p/1/000/016/1da/2580e68.jpg
http://media.linkedin.com/mpr/mpr/shrink4040/p/1/000/026/328/2d2a6dd.jpg
http://media.linkedin.com/mpr/mpr/shrink4040/p/1/000/02d/3b0/12ecb61.jpg
http://media.linkedin.com/mpr/mpr/shrink4040/p/2/000/006/03e/2ef8bc3.jpg
http://media.linkedin.com/mpr/mpr/shrink4040/p/2/000/024/0c5/388f1b9.jpg
http://media.linkedin.com/mpr/mpr/shrink4040/p/2/000/025/2df/0c3811c.jpg
http://media.linkedin.com/mpr/mpr/shrink4040/p/2/000/02f/07c/132d0b3.jpg
http://media.linkedin.com/mpr/mpr/shrink4040/p/3/000/001/3f0/030ac93.jpg
http://media.linkedin.com/mpr/mpr/shrink4040/p/3/000/00d/12d/32e41f1.jpg
http://media.linkedin.com/mpr/mpr/shrink4040/p/3/000/016/0be/0056f07.jpg
http://media.linkedin.com/mpr/mpr/shrink4040/p/3/000/01a/1d6/2615db3.jpg
http://media.linkedin.com/mpr/mpr/shrink6030/p/1/000/01c/1f7/19dad55.png
http://pixel.quantserve.com/pixel;r=658689321;fpan=0;fpa=P0-143687348-1251263803 769;ns=0;url=http%3A%2F%2Fwww.linkedin.com%2FgroupAnswers%3FviewQuestions%3D%26g id%3D1806481%26forumID%3D3%26sik%3D1251654122855%26goback%3D%252Eanh1806481;ref=http%3A%2F%2Fwww.linkedin.com%2FgroupAnswers%3FviewQuestionAndAnswer s%3D%26gid%3D1806481%26discussionID%3D6408805%26goback%3D%252Eanh1806481;ce=1;je=1;sr=1024x768x24;dg=P5801-M-Sa-u;dst=1;et=1251654143363;tzo=420; a=p-b3sGjMtCFrexE
http://static.linkedin.com/scds/concat/leo/build-4977_2253-prod/css?f=css%2Fminiprofile&f=css%2Fanet&f=css%2Fanetmember
http://static.linkedin.com/scds/concat/leo/build-49772253-prod/css?f=css%2Freset&f=lib%2Fyui%2F2.7.0%2Fcontainer%2Fassets%2Fcontainer &f=css%2Fdefault&f=css%2Fchrome&f=css%2Fnavigation&f=css%2Fmodules&f=css%2Fdialo g&f=css%2Fforms
http://static.linkedin.com/scds/concat/leo/build-4977_2253-prod/js?f=js%2Fanet_member&f=js%2Fminipanel&f=js%2Fminiprofilepopup&f=js%2Fapps%2FAnetFollow&f=js%2Fapps%2FAnetMoveOrDelete&f=js%2Fapps%2FAnet DialogHelper
http://static.linkedin.com/scds/concat/leo/build-4977_2253-prod/js?f=js%2Fstatus&f=js%2Futil%2FSaveUISetting&f=js%2Futil%2FDialog&f= js%2Fapps%2FFeedback&f=static_dwrjs%2FFeedbackService
http://static.linkedin.com/scds/concat/leo/build-49772253-prod/js?f=js%2Futil%2FDropList
http://static.linkedin.com/scds/concat/leo/build-4977_2253-prod/js?f=lib%2F_yaho&f=lib%2F_data&f=lib%2F_conn&f=lib%2F_auto&f=lib%2F_ anim&f=lib%2F_selc&f=lib%2F_cont&f=lib%2F_get&f=js%2Fcore%2FDefine&f=js%2Futil%2 FHelps&f=js%2Fcore%2FControls&f=js%2Fcore%2FPage&f=js%2Fcore%2Fi18n&f=lib%2Flui% 2Flinkedin_url-min&f=js%2Fglobal_navigation&f=js%2Fads&f=js%2Futil%2FGhostLabel& f=js%2Futil%2FFocusField&f=js%2Fajax%2Fchameleon_service&f=js%2Fopensocial%2Frpc &f=js%2Fopensocial%2Futil&f=js%2Fopensocial%2Fgadgets&f=js%2Fopensocial%2Fgadget _container&f=lib%2Fdwr%2F2.0%2Futil-min&f=lib%2Fdwr%2F2.0%2Fengine-min&f=lib%2Fd wr%2F2.0%2Fengine_fix-min&f=js%2Fajax%2Fui_settings_service&f=js%2Fajax%2Fwebtra cking_service&f=js%2Fajax%2Ftypeahead_service&f=static_dwr_js%2FUISettingsServic e&f=static_dwr_js%2FTypeAheadService&f=static_dwr_js%2FWebTrackingService&f=stat ic_dwrjs%2FChameleonAjaxService&f=js%2Futil%2FShowMore&f=js%2Futil%2FCheckTextarea&f=j s%2Fapps%2FMboxArchiveOnHome&f=js%2Fapps%2FPersonalNav&f=js%2Futil%2FSelectMenu
http://static01.linkedin.com/img/bg/bgbtn500x52.png
http://static01.linkedin.com/img/bg/bggrey_dotted_h-line3x1.png
http://static01.linkedin.com/img/bg/bgprofile_navleft.gif
http://static01.linkedin.com/img/bg/bgprofile_navright.gif
http://static01.linkedin.com/img/bg/bgstickybox154x1600.png
http://static02.linkedin.com/img/bg/bg99cce61x1.gif
http://static02.linkedin.com/img/bg/bgmodule_top_v1_e8e8e8900x27.png
http://static02.linkedin.com/img/icon/icondiscuss46x46.gif
http://static02.linkedin.com/img/sprite/spriteanetv3.png
http://static02.linkedin.com/img/sprite/spritepersonalnavv1.png
http://static03.linkedin.com/img/pic/piclogo119x32.png
http://static03.linkedin.com/img/sprite/spriteglobalnavv7.png
http://static03.linkedin.com/img/sprite/spritesectionheaderv2.png
http://www.linkedin.com/groupAnswers?viewQuestions=&gid=1806481&forumID=3&sik=12 51654122855&goback=%2Eanh_1806481
http://apps.facebook.com/onthefarm/gifts.php?ref=interstitial
http://2.channel06.facebook.com:80/iframe/10?r=http%3A%2F%2Fstatic.ak.fbcdn.net% 2Frsrc.php%2Fz14HW%2Fhash%2F7iwb5azs.js&r=http%3A%2F%2Fstatic.ak.fbcdn.net%2Frsr c.php%2Fz83D4%2Fhash%2Ff0g34qhl.js&r=http%3A%2F%2Fstatic.ak.fbcdn.net%2Frsrc.php %2Fz4K1F%2Fhash%2F1xkawojl.js&r=http%3A%2F%2Fstatic.ak.fbcdn.net%2Frsrc.php%2Fz8 GNX%2Fhash%2F5w82eq2r.js&r=http%3A%2F%2Fstatic.ak.fbcdn.net%2Frsrc.php%2Fz6QHU%2 Fhash%2F5q6e3i19.js
http://fbpr1-proxy.farmville.zynga.com/current/populateFbCache.php?fbsig_in_iframe=1&fb_sig_locale=en_US&fb_sig_in_new_facebook=1&fb_sig_time=1251654 112.5173&fb_sig_added=1&fb_sig_profile_update_time=1241222561&fb_sig_expires=125 1741600&fb_sig_user=1258957032&fb_sig_session_key=2.urjhbOXkXpAWqvRt5Z1A5w__.864 00.1251741600-1258957032&fb_sig_ss=ZOlmUbU7fITfm1kHsdC_XQ__&fb_sig_ext_perms=aut o_publish_recent_activity&fb_sig_api_key=80c6ec6628efd9a465dd223190a65bbc&fb_sig _app_id=102452128776&fbsig=e1c2f51b50486011cd9433df3fbccc35
http://zbar2.zynga.com/zbar-new/textads.php?uid=1258957032&snid=1&gid=63&fbsig_in_iframe=1&fb_sig_locale=en_US&fb_sig_in_new_facebook=1&fb_sig_time=1251654 112.4702&fb_sig_added=1&fb_sig_profile_update_time=1241222561&fb_sig_expires=125 1741600&fb_sig_user=1258957032&fb_sig_session_key=2.urjhbOXkXpAWqvRt5Z1A5w__.864 00.1251741600-1258957032&fb_sig_ext_perms=auto_publish_recent_activity&fb_sig_ap i_key=80c6ec6628efd9a465dd223190a65bbc&fb_sig_app_id=102452128776&fbsig=486bedd739fd72fbc10a4ba6442a7099
http://apps.facebook.com/onthefarm/gifts.php?ref=interstitial
http://apps.facebook.com/swf/canvas/FlashFBJS.swf?v=2
http://b.static.ak.fbcdn.net/rsrc.php/zO4B1/hash/94y4e2fx.js
http://creative.ak.fbcdn.net/ads3/flyers/100/0/600232950698818b21ba6c.jpg
http://creative.ak.fbcdn.net/ads3/flyers/3/2/600252429322516da668de.jpg
http://creative.ak.fbcdn.net/ads3/flyers/51/28/60023061995891da572fed.jpg
http://creative.ak.fbcdn.net/ads3/flyers/82/58/600223888578111002d87d.jpg
http://facebook.farmville.static.zynga.com/v4415/assets/animals/chicken.swf
http://facebook.farmville.static.zynga.com/v4415/assets/animals/cow.swf
http://facebook.farmville.static.zynga.com/v4415/assets/animals/duck.swf
http://facebook.farmville.static.zynga.com/v4415/assets/animals/goat.swf
http://facebook.farmville.static.zynga.com/v4415/assets/animals/horse.swf
http://facebook.farmville.static.zynga.com/v4415/assets/animals/pig.swf
http://facebook.farmville.static.zynga.com/v4415/assets/animals/rabbit.swf
http://facebook.farmville.static.zynga.com/v4415/assets/animals/sheep.swf
http://facebook.farmville.static.zynga.com/v4415/assets/trees/treeappleicon.png
http://facebook.farmville.static.zynga.com/v4415/assets/trees/treeapricoticon.png
http://facebook.farmville.static.zynga.com/v4415/assets/trees/treeavocadoicon.png
http://facebook.farmville.static.zynga.com/v4415/assets/trees/treebananaicon.png
http://facebook.farmville.static.zynga.com/v4415/assets/trees/treecherryicon.png
http://facebook.farmville.static.zynga.com/v4415/assets/trees/treedateicon.png
http://facebook.farmville.static.zynga.com/v4415/assets/trees/treefigicon.png
http://facebook.farmville.static.zynga.com/v4415/assets/trees/treegrapefruiticon.png
http://facebook.farmville.static.zynga.com/v4415/assets/trees/treelemonicon.png
http://facebook.farmville.static.zynga.com/v4415/assets/trees/treelimeicon.png
http://facebook.farmville.static.zynga.com/v4415/assets/trees/treeorangeicon.png
http://facebook.farmville.static.zynga.com/v4415/assets/trees/treepassionfruiticon.png
http://facebook.farmville.static.zynga.com/v4415/assets/trees/treepeachicon.png
http://facebook.farmville.static.zynga.com/v4415/assets/trees/treeplumicon.png
http://facebook.farmville.static.zynga.com/v4415/assets/trees/treepomegranateicon.png
http://facebook2.farmville.static.zynga.com/current/images/FVlogo_headerbar.png
http://facebook2.farmville.static.zynga.com/current/images/gift/giftboxlocked.png?v=1
http://facebook2.farmville.static.zynga.com/current/images/gift/giftboxopen.png?v=1
http://photos-a.ak.fbcdn.net/photos-ak-sf2p/v43/144/102452128776/app2_102452128776416.gif
http://photos-a.ak.fbcdn.net/photos-ak-sf2p/v43/144/102452128776/app2_102452128776416.gif
http://photos-d.ak.fbcdn.net/photos-ak-sf2p/v43/191/7629233915/app2_76292339157653.gif
http://photos-e.ak.fbcdn.net/photos-ak-sf2p/v43/156/48453901932/app2_484539019329208.gif
http://photos-e.ak.fbcdn.net/photos-ak-sf2p/v43/176/81708710756/app2_817087107568743.gif
http://photos-e.ak.fbcdn.net/photos-ak-sf2p/v43/96/43016202276/app2_430162022763195.gif
http://photos-f.ak.fbcdn.net/photos-ak-sf2p/v43/33/5388815661/app2_53888156613897.gif
http://photos-g.ak.fbcdn.net/photos-ak-sf2p/v43/10/12572207686/app2_125722076868188.gif
http://static.ak.fbcdn.net/js/api_lib/v0.4/FeatureLoader.js.php
http://static.ak.fbcdn.net/rsrc.php/z14HW/hash/7iwb5azs.js
http://static.ak.fbcdn.net/rsrc.php/z1BIE/hash/325ranhi.js
http://static.ak.fbcdn.net/rsrc.php/z2ERA/hash/ecqu6015.css
http://static.ak.fbcdn.net/rsrc.php/z2HFX/hash/bjamloip.gif
http://static.ak.fbcdn.net/rsrc.php/z2SP1/hash/etnp9ohm.js
http://static.ak.fbcdn.net/rsrc.php/z3KHR/hash/26d2mc00.js
http://static.ak.fbcdn.net/rsrc.php/z4K1F/hash/1xkawojl.js
http://static.ak.fbcdn.net/rsrc.php/z4PO0/hash/1ede2tq2.gif
http://static.ak.fbcdn.net/rsrc.php/z5GY4/hash/3x5gmvl5.css
http://static.ak.fbcdn.net/rsrc.php/z5O5U/hash/bbqws739.js
http://static.ak.fbcdn.net/rsrc.php/z5SGV/hash/c0gh7cd5.css
http://static.ak.fbcdn.net/rsrc.php/z61KN/hash/4tjt34bx.js
http://static.ak.fbcdn.net/rsrc.php/z6GC1/hash/e37aeurf.css
http://static.ak.fbcdn.net/rsrc.php/z7HIV/hash/7hz3d5lf.js
http://static.ak.fbcdn.net/rsrc.php/z7SJX/hash/7inlmzb8.gif
http://static.ak.fbcdn.net/rsrc.php/z7TAO/hash/6tfdui4g.css
http://static.ak.fbcdn.net/rsrc.php/z7Y4V/hash/1jxsp4yb.css
http://static.ak.fbcdn.net/rsrc.php/z83D4/hash/f0g34qhl.js
http://static.ak.fbcdn.net/rsrc.php/z8CH4/hash/m773k1wp.gif
http://static.ak.fbcdn.net/rsrc.php/z8GNX/hash/5w82eq2r.js
http://static.ak.fbcdn.net/rsrc.php/z8LVM/hash/2nbetqg8.js
http://static.ak.fbcdn.net/rsrc.php/z8TSF/hash/8wzuz4qf.js
http://static.ak.fbcdn.net/rsrc.php/z96VU/hash/2gmbnh27.css
http://static.ak.fbcdn.net/rsrc.php/z9H0B/hash/9p3yvolv.gif
http://static.ak.fbcdn.net/rsrc.php/z9I9Z/hash/cofdq77a.gif
http://static.ak.fbcdn.net/rsrc.php/z9KI5/hash/94qxapy3.png
http://static.ak.fbcdn.net/rsrc.php/z9REH/hash/444iml1v.css
http://static.ak.fbcdn.net/rsrc.php/z9VWZ/hash/6il3caqt.css
http://static.ak.fbcdn.net/rsrc.php/zBS4M/hash/br4tlqqh.gif
http://static.ak.fbcdn.net/rsrc.php/zBYGC/hash/800lxbfp.js
http://static.ak.fbcdn.net/rsrc.php/zCRE0/hash/l0u9mkwh.css
http://static.ak.fbcdn.net/rsrc.php/zCRQD/hash/byk4gohu.js
http://static.ak.fbcdn.net/rsrc.php/zD1UP/hash/aw2zp1zq.css
http://static.ak.fbcdn.net/rsrc.php/zD3LH/hash/81xy5xz9.png
http://static.ak.fbcdn.net/rsrc.php/zDGRQ/hash/1fpqoxvn.js
http://static.ak.fbcdn.net/rsrc.php/zDNY1/hash/8cx9ovtr.js
http://static.ak.fbcdn.net/rsrc.php/zENB0/hash/1514rxc8.js
http://static.ak.fbcdn.net/rsrc.php/zENR1/hash/bn9iieje.css
http://static.ak.fbcdn.net/rsrc.php/zF0N8/hash/d3aaxegc.css
http://www.google-analytics.com/_utm.gif?utmwv=1.3&utmn=127179699&utmcs=UTF-8&utmsr=1024x768&utmsc=24-bit&utmul= en&utmje=1&utmfl=10.0%20r32&utmcn=1&utmdt=FarmVille%20on%20Facebook&utmhn=apps.f acebook.com&utmhid=860573154&utmr=http://apps.facebook.com/onthefarm/index.php?r ef=bookmark&utmp=/onthefarm/gifts.php?ref=interstitial&utmac=UA-9830736-1&utmcc= __utma%3D87286159.1174266351.1251304022.1251562847.1251654117.6%3B%2B_utmz%3D87286159.1251654117.6.6.utmccn%3D(referral)%7Cutmcsr%3Dapps.facebook.com%7Cutmcct%3D%2Fonthefarm%2Findex.php%7Cut mcmd%3Dreferral%3B%2B
http://www.google-analytics.com/urchin.js
http://www.plentyoffish.com/inbox.aspx?Guid=&SID=#in
http://pubads.g.doubleclick.net/gampad/ads?correlator=1251654074212&output=html& impl=ifr&client=ca-pub-3876727481877168&slotname=inbox300&page_slots=inbox_300&cust_params=age%3D60%26gender%3D0%26ethnicity%3D4%26log incount%3D200%26pageviews%3D2%26haskids%3D3%26searchtype%3D7%26body%3D4%26educat ion%3D13422%26income%3D0%26car%3D1%26drinking%3D2%26profession%3Drealestateconsu ltant%26religion%3D7%26marital_status%3D4%26smoking%3D1%26height%3D193%26state_i d%3D11&cookie=ID%3Dfcdb59fba6d71779%3AT%3D1251654074%3AS%3DALNI_MbbAvOxxD4RJL8PM GOvnVq-73qLkw&cookie_enabled=1&ga_vid=1287329211.1251489141&ga_sid=1251654051&ga _hid=1154186178&ga_fc=true&url=http%3A%2F%2Fwww.plentyoffish.com%2Finbox.aspx%3F Guid%3D%26SID%3D%23in&ref=http%3A%2F%2Fwww.plentyoffish.com%2Finbox.aspx&lmt=NaN &dt=1251654074310&cc=100&kw=dating%2Bservice%2C%20dating&kw_type=broad&channel=5 3%2B13%2B63%2B90%2B47%2B87&color_border=FFFFFF&color_bg=FFFFFF&color_link=CC00CC &color_url=000000&color_text=000000&cust_gender=1&cust_age=1005&u_tz=-420&u_his= 2&u_java=true&u_h=768&u_w=1024&u_ah=746&u_aw=1020&u_cd=24&u_nplug=17&unmime=176&flash=10.0.32
http://partner.googleadservices.com/gampad/cookie.js?callback=GAgoogleCookieHelper.setCookieInfo&client=ca-pub-3876727481877168&domain=www.plent yoffish.com
http://partner.googleadservices.com/gampad/google_ads.js
http://partner.googleadservices.com/gampad/google_service.js
http://pics.plentyoffish.com/menu/b/bb.gif
http://pics.plentyoffish.com/menu/b/blc.gif
http://pics.plentyoffish.com/menu/b/brc.gif
http://pics.plentyoffish.com/menu/b/l.gif
http://pics.plentyoffish.com/menu/b/r.gif
http://pics.plentyoffish.com/menu/b/tb.gif
http://pics.plentyoffish.com/menu/b/tlc.gif
http://pics.plentyoffish.com/menu/b/trc.gif
http://pics.plentyoffish.com/menu/bgmenu.gif
http://pics.plentyoffish.com/menu/bgmenu2test.gif
http://pics.plentyoffish.com/menu/h6g.jpg
http://pics.plentyoffish.com/menu/styletest.css
http://pics.plentyoffish.com/menu/t4.gif
http://pics.plentyoffish.com/thumbnails/41/nw4ueh45ir_15176335.jpg
http://pics.plentyoffish.com/thumbnails/54/salinaspersonalsB34958127.jpg
http://pics.plentyoffish.com/thumbnails/58/59/3r4woh45ul_42543139.jpg
http://pics.plentyoffish.com/thumbnails/58/91/Montereydating43658493.jpg
http://pics.plentyoffish.com/thumbnails/59/55/Seasidedating47989674.jpg
http://pics.plentyoffish.com/thumbnails/61/96/PebbleBeachdating50673285.jpg
http://pics.plentyoffish.com/thumbnails/62/85/412jlo454s_53172452.jpg
http://pics.plentyoffish.com/thumbnails/62/88/0g5vnk3dnf_53497414.jpg
http://pics.plentyoffish.com/thumbnails/63/26/q4w5si45su_55200614.jpg
http://pics.plentyoffish.com/thumbnails/63/34/uz1onii15q_56637026.jpg
http://pics.plentyoffish.com/thumbnails/63/50/ddaqbx45ju_58861335.jpg
http://pics.plentyoffish.com/thumbnails/63/70/Marinapersonals54987682.jpg
http://pics.plentyoffish.com/thumbnails/63/78/Salinasdating55245068-2.jpg
http://pics.plentyoffish.com/thumbnails/63/96/PacificGrovedating57540862-2.jpg
http://pics.plentyoffish.com/thumbnails/64/24/montereydating60525070.jpg
http://pics.plentyoffish.com/thumbnails/64/48/Montereymatchmaking60831180.jpg
http://pics.plentyoffish.com/thumbnails/64/59/b35ydhrq0v_59724666.jpg
http://pics.plentyoffish.com/thumbnails/64/82/kwwt5q45ck_60978854.jpg
http://pics.plentyoffish.com/thumbnails/64/91/montereypersonals61370301.jpg
http://pubads.g.doubleclick.net/gampad/testgamdomain.js
http://www.google-analytics.com/_utm.gif?utmwv=4.3.1&utmn=1410562142&utmhn=www.plentyoffish.com&utmcs=UTF-8&utms r=1024x768&utmsc=24-bit&utmul=en&utmje=1&utmfl=10.0%20r32&utmdt=Online%20Dating% 20Service%2C%20Meet%20Singles%2C%20Matchmaking&utmhid=1154186178&utmr=0&utmp=/in box.aspx?Guid=&SID=&utmac=UA-172947-1&utmcc=__utma%3D9489908.1287329211.12514891 41.1251600983.1251654051.6%3B%2B_utmz%3D9489908.1251654051.6.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none)%3B%2B__utmv%3D9489908.Male%252045 %2520United%2520States%252013422%3B
http://www.google-analytics.com/_utm.gif?utmwv=4.3.1&utmn=584345307&utmhn=www.plentyoffish.com&utmt=var&utmac=UA -172947-1&utmcc=__utma%3D9489908.1287329211.1251489141.1251600983.1251654051.6%3 B%2B_utmz%3D9489908.1251654051.6.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none)%3B%2B__utmv%3D9489908.Male%252045 %2520United%2520States%252013422%3B
http://www.google-analytics.com/ga.js
http://www.plentyoffish.com/1024a.css
http://www.plentyoffish.com/closed.gif
http://www.plentyoffish.com/follow.js
http://www.plentyoffish.com/helperb.js
http://www.plentyoffish.com/imagesfiles/button_sndtrnsp.gif
http://www.plentyoffish.com/inbox.aspx?Guid=&SID=#in
http://www.plentyoffish.com/screenres.js
http://www.plentyoffish.com/tracking.js -
App made with Director runs slower and slower
Testing our nearly completed game, we are finding that on
systems with 1GB memory, the game will run smoothly at first but
after playing the game 4-5 times, it really slows down frame rate
wise. Systems with 2GB seem to be fine.
So. it seems it is running out of memory.
Basically, the player can choose a song they want to sing and
a 3D venue they want to perform at. They can also record their
performance so there is a lot going on. Playing mp3, recording
audio, running 3d window, managing 2d sprites, real-time pitch
analysis, etc... Even if the player chooses to "try again" which
allows them to keep singing same song, same venue, etc... the game
slows down.
I did a bit of research and it appears Director does memory
management itself and frees up cast members automatically when
running low on memory.
If the system has enough memory to play the game smoothly at
first, and Director frees up members when low on memory, what else
can I do to help resolve this problem?
Thank you!You might look for strategic locations to place the "unload"
function.
Such as not while its playing music or video.
65Cobra wrote:
> Testing our nearly completed game, we are finding that
on systems with 1GB
> memory, the game will run smoothly at first but after
playing the game 4-5
> times, it really slows down frame rate wise. Systems
with 2GB seem to be fine.
>
> So. it seems it is running out of memory.
>
> Basically, the player can choose a song they want to
sing and a 3D venue they
> want to perform at. They can also record their
performance so there is a lot
> going on. Playing mp3, recording audio, running 3d
window, managing 2d
> sprites, real-time pitch analysis, etc... Even if the
player chooses to "try
> again" which allows them to keep singing same song, same
venue, etc... the game
> slows down.
>
> I did a bit of research and it appears Director does
memory management itself
> and frees up cast members automatically when running low
on memory.
>
> If the system has enough memory to play the game
smoothly at first, and
> Director frees up members when low on memory, what else
can I do to help
> resolve this problem?
>
> Thank you!
>
> -
I need to aplly a multiply filter (src*dest) to these iamges
image=(BufferedImage)sprite.getSprite(spriteName);
multi=(BufferedImage)sprite.getSprite("degra.jpg");
for i...
for j..
color=image.getRGB(i,j)*multi.getRGB(i,m);
image.setRGB(i,j,(int)color);
but is soooo slow. Could someone help me?.Take a look at this thread. It specifically has to do with adding colors, but it should give you the general idea
http://forum.java.sun.com/thread.jspa?threadID=640347 -
Very Slow / Lag When Screen Moves...
Hi Guys,
I’m really a newbie when it comes to AS3 – so really a total newbie when it comes to using it to develop iPhone games/apps, but I have used AS2 for years now
I’ve been trying to do a simple test – Just use mouse events to move a screen around depending on what is pressed. No Characters/hittests/etc.
What I have created works great on my pc – very smooth, and even on the iphone, the controls work as expected – but the problem is how SLOW everything is running. Pressing the "UP" arrow - makes the screen move, but very SLOW and Jumpy.
I have tried using onkeyframe and using a timer – but both are very slow.
Typically when I made games in AS2 – the “level” would just be a single BIG movieclip – as shown in “Example A” – but this was very slow on the iphone, so I tried a tile based approach (“Example B”), which reuses the same movieclips, it just moves them and renames them – trying to cut memory usage down, only loading what is needed - but still its slow. The total size of the "level" is only about 3x bigger than the iphone visible screen.
I have made sure all variables are done correctly: var thisVar:int = 10; etc and have enabled cache as bitmap. I have replaced all vector graphics with jpegs, and followed the guide on how to optimize code for iphone development – but nothing seems to work, everything just lags as the screen moves/updates – but everything works great on my pc.
Can someone please explain what I am doing wrong? Is there a way to cache the whole map before the game loads? Which is the correct way to make an iphone game where the level is bigger than the default screen - tile based or a large level graphic.
Thanks so much for any help! I’ve been trying to get this simple test working for 3 days now – but documentation is limited at the moment.
Cheers!This should be better:
the function addPage() is what I used to test Bitmaps
import flash.display.Shape;
import flash.display.Sprite;;
Multitouch.inputMode = MultitouchInputMode.GESTURE;
var currentGalleryItem:Number = 1;
var totalGalleryItems:Number = 4;
var slideCounter:Number = 0;
var gallery_items:Sprite = new Sprite();
addChild(gallery_items);
addPages();
stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeToGoToNextPreviousFrame);
// create pages
function addPages():void
addShape(0, 0, 0xff0000);
addShape(768, 0, 0x00ff00);
addShape(1536, 0, 0x0000ff);
function addPage(xPos:Number, yPos:Number):void
var p:Bitmap = new Bitmap(new bookPage());
p.x = xPos;
p.y = yPos;
gallery_items.addChild(p);
function addShape(xPos:Number, yPos:Number, col:uint):void
var s:Shape = new Shape();
s.graphics.beginFill(col);
s.graphics.drawRect(xPos, yPos, 768, 1028);
s.graphics.endFill();
gallery_items.addChild(s);
function fl_SwipeToGoToNextPreviousFrame(event:TransformGestureEvent):void
if(event.offsetX == 1)
if(currentGalleryItem > 1){
currentGalleryItem--;
slideRight();
else if(event.offsetX == -1)
if(currentGalleryItem < totalGalleryItems){
currentGalleryItem++;
slideLeft();
function slideLeft(){
gallery_items.addEventListener("enterFrame", moveGalleryLeft);
function slideRight(){
gallery_items.addEventListener("enterFrame", moveGalleryRight);
function moveGalleryLeft(evt:Event){
gallery_items.x -= 76.8;
slideCounter++;
if(slideCounter == 10){
gallery_items.removeEventListener("enterFrame", moveGalleryLeft);
slideCounter = 0;
function moveGalleryRight(evt:Event){
gallery_items.x += 76.8;
slideCounter++;
if(slideCounter == 10){
gallery_items.removeEventListener("enterFrame", moveGalleryRight);
slideCounter = 0; -
First off, I don't understand how rendering works with
an image that is partially visible on screen. Let's say
for example, I have a sprite that is half off screen,
in my rendering method, when I say g2D.drawImage(sprite.getImage(), sprite.getX(), sprite.getY(), observer); What exactly happens? Is time wasted trying to
draw the pixels that are not on the screen? Please ask
me to specify if any other information is needed. Thanks
in advance.
Here are the specs that may be useful:
- uses BuffereStrategy (3 buffers)
- undecorated 'Frame' at fullscreen exclusive mode (640 by 480)I've often wondered this.
While testing a game I'm working on at the moment I was drawing about 10000 drawRect()'s to the screen per game loop, obviously this slowed the game down, but, when the drawRect()'s weren't onscreen (once I scrolled passed them) the game speed shot back up, so I'm guessing if it isn't drawing drawRect()'s that aren't visible maybe the same applies to images, although I'd further guess that the whole image has to be off screen before its not being drawn, unless java is doing something super cool with the raster (is that right?) that is.
Further, clarification on this from someone who isn't guessing would be nice :)
Maybe you are looking for
-
Why is there a 30 day limit for email on the Playbook
Sorry this isn't really a support question but I was wondering if anyone knows why they maintained the maximum 30 day limit on email etc for the Playbook. I kinda understand the logic for a phone (although it would be nice to have the option of all
-
IMac Intel slow to connect to Internet
Hi there. I am using a new 24" Intel iMac but am finding that it is taking a while to connect to the internet. It sort of sits there like it's thinking for about 5 seconds and then goes to the page. It is connected to a network via Ethernt and basica
-
Iphone screen is white!?
I had a text earlier today, answered back, my phone locked (like it always does when I'm done using it) then I go to type in my code to reset my alarm, and the screen is frozen??? I guess. I can hear the attempts to type in the code, but no numbers a
-
Hanging on blue screen during boot (but Safe Mode OK)
Strange stuff with my iMac G5 -- machine boots normally, gets through Apple icon and spinning spiral, then hangs on blue screen and stays there. Mouse cursor moves but that's it. Safe boot works normally, all safe-mode functions good. But need networ
-
Where can I download I Movie for OS X 10.8.5?
Hi, Where can I download I Movie for OS X 10.8.5 that is safe? Thanks Ted