|
|
|
#1 |
|
Say hello to Bob
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? |
|
|
|
|
|
#2 |
|
Style Through Simplicity
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 |
|
|
|
|
|
#3 |
|
Say hello to Bob
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? |
|
|
|
|
|
#4 |
|
Say hello to Bob
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? |
|
|
|
|
|
#5 |
|
Style Through Simplicity
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
}
}
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) Hope that helps. Ali Last edited by alillm; 08-21-2005 at 06:26 PM. |
|
|
|
|
|
#6 |
|
Say hello to Bob
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? |
|
|
|
|
|
#7 |
|
Style Through Simplicity
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 |
|
|
|
![]() |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|