To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > General Help > Games

Reply
 
Thread Tools Search this Thread Display Modes
Old 08-21-2005, 05:53 PM   #1
Kakihara
Say hello to Bob
 
Kakihara's Avatar
 
Join Date: Jul 2004
Location: kent, England
Posts: 1,067
using function for coded mcs[help]

Hi,

What I mean by the crap title is that I want to move mcs collectively using a function and a loop which I can do but I dont want the mcs to actually be mcs, I want them to exist in code only but I want to be able to do everything with them as I would do with an mc, so I want to be able to move them according to their own variables and hit test them with other mcs.

First off if I did this would it be any quicker framerate wise if I did this as opposed to moving many mcs around?

Second of all is it possible, I suppose its a bit like a los engine but im not too familiar with those and as I said ive got all the code layed out that I want the 'mcs' to function with but I dont know how to create what ive stated.

Anyone know how I can achieve this, im looking for the simplest way of doing this.

Thanks in advance.
__________________
If our body is a clock ticking away and if while we experience all that this world has to offer time has still continued to pass, are we living or just experiencing a slow death?
Kakihara is offline   Reply With Quote
Old 08-21-2005, 06:05 PM   #2
alillm
Style Through Simplicity
 
alillm's Avatar
 
Join Date: Mar 2004
Location: Wales
Posts: 1,987
Im not sure if it would be faster or not. It probably would be, but you would surley need movie clips on stage anyway, or you would just have a blank screen .

One way of doing it would be to make an object to represent each movieClip.
You can store all its variables in it, and give it an x and y variable which you could increase or decrese to simulate moving. Then you could give it dimentions and simulate collision. It isnt hard. Why do you want to do it?

Ali
alillm is offline   Reply With Quote
Old 08-21-2005, 06:10 PM   #3
Kakihara
Say hello to Bob
 
Kakihara's Avatar
 
Join Date: Jul 2004
Location: kent, England
Posts: 1,067
Im using mcs at the moment which are fired at different angles and bounce off of walls and if they hit a player they send information back to an enemy which uses the info to fire at the player, basically it enables the enemy to shoot off of walls and hit the player.

But ive realised I need greater accuracy which means more mcs which means slowdown, so I was wondering about this option.

If I cant do this ive gotanother option which is still using actual mcs but firing them in smaller groups so there are only a few on screen at any one time so the game shouldnt run into slowdown, only problem with this is that the enemy will be quite vulnerable.

Thanks for your thoughts.
__________________
If our body is a clock ticking away and if while we experience all that this world has to offer time has still continued to pass, are we living or just experiencing a slow death?
Kakihara is offline   Reply With Quote
Old 08-21-2005, 06:20 PM   #4
Kakihara
Say hello to Bob
 
Kakihara's Avatar
 
Join Date: Jul 2004
Location: kent, England
Posts: 1,067
Ok ive found another solution which is to move the mcs and the check so quickly that the game will slowdown for only half a second, its not a great solution but it will have to do if noone knows how to do this properly and really aid the fps.
__________________
If our body is a clock ticking away and if while we experience all that this world has to offer time has still continued to pass, are we living or just experiencing a slow death?
Kakihara is offline   Reply With Quote
Old 08-21-2005, 06:23 PM   #5
alillm
Style Through Simplicity
 
alillm's Avatar
 
Join Date: Mar 2004
Location: Wales
Posts: 1,987
Well you could give objects a go. I don't know how it will work out, but its worth a try.
I have no idea how you create objects inside a .fla but im sure it can be done, you can use a class though.

Just make a new action script file, and put somthing like this.

Code:
class bouncer {
private var width:Number
private var height:Number
private var xspeed:Number
private var yspeed:Number
private var x:Number
private var y:Number
public function bouncer(w, h, xCoord, yCoord, sx, sy) {
width = w
height = h
x = xCoord
y = yCoord
xspeed = sx
yspeed = sy
}
}
Then save that file as bouncer, and put it in the same directory as your .fla.

That basicly just creates an object when called, which just stores all the info you need for each pretend mc.

Then in your .fla, for each object you want, just do somthing like this.

Code:
bouncer1 = new bouncer(20, 20, 50, 100, 5, 3)
then loop through all your objects and change the variables accordinly. Check for collision using the x and y positions along with the width and height.

Hope that helps.

Ali

Last edited by alillm; 08-21-2005 at 06:26 PM.
alillm is offline   Reply With Quote
Old 08-21-2005, 06:27 PM   #6
Kakihara
Say hello to Bob
 
Kakihara's Avatar
 
Join Date: Jul 2004
Location: kent, England
Posts: 1,067
Ill give it a go, I dont think it will give me the fps im looking for though so ill try another couple of things first.

Thanks anyway im sure it will come in handy for other projects.
__________________
If our body is a clock ticking away and if while we experience all that this world has to offer time has still continued to pass, are we living or just experiencing a slow death?
Kakihara is offline   Reply With Quote
Old 08-21-2005, 06:39 PM   #7
alillm
Style Through Simplicity
 
alillm's Avatar
 
Join Date: Mar 2004
Location: Wales
Posts: 1,987
Probably wont but it will save flash from rendering a bunch of needless movie clips, and if they are 0% alpha then that would be even worse. It should get you some speed increase, but nothing massive. (depends how many you were/are using).

Yup, this is usefull for all kinds of things. Im just starting to learn OOP myself, and its proving really good

Ali
alillm is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > General Help > Games

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:57 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.