ActionScript 2.0 :: Curved HitTests For Flash 2004 MX?
Aug 16, 2006how do you make a curved/slanted hitTest?
View 1 Replieshow do you make a curved/slanted hitTest?
View 1 RepliesMy fish is swimming along and needs to catch the food and avoid the poison. I've attempted to create arrays for the food and the poison so they are randomly dropping down. I've also added a hittest but can't get it to work.
I'm not really happy with the randomisation of the array, there are too many instances appearing on screen and I'm not sure how to fix this. Is there an easier way to animate the food dropping down without using as2 and arrays? There is also something wrong with my score, each food should be +10 to score and poison should be -10, but that doesn't seem to be working either. I also don't know what script to type to end the game to either a congratualtions screen or game over screen. Basically I have no idea what I'm doing and haven't had much help from my teacher, he may as well be speaking another language.
I'm trying to draw this hint box and was wondering if anyone could explain to me how to draw a curved line like the one below in flash?
View 4 RepliesI'm trying to create simple 2D action game, something similar to well known Fancy Pants Adventures :) I've been looking for answer for more than week and all I've found is [URL] which not answers the question. (I've found also moving on platforms that are rotated but that's not I'm looking for). I have also found great (and free!) flash game engine - CitrusEngine which I'm currently using, but, it doesn't provide moving hero along curved terrain. How to make hero moving along curved terrain like this one: [URL]. There are plenty of games like this (for ex. Fancy Pants or Robot Unicorn Attack) where main character moves along the curved terrain but I can't find answer how can I do that.
View 2 RepliesI made this one poor class that has a public function which draws with a single loop a shape with curveTo() function (I tested one option to draw straight lines with lineTo() and only curved lines with curveTo() function but in my opinion, that lineTo function where a bit slower, at least in my implementations of testin speeds).I sent to it four parameters (anchor points and the control points) as many times as there were some corners to draw and everything seemed to go well untill I checked which way is faster to draw single rounded rect. Flashs own way beats my version up with huge 120 m/s distance already in some 100 000 iterations. The format of data I tested to send to my class function to draw that goddamned thing were numbers in arrays, numbers in objects and numbers in my own class objects like linked list and the file that holds just four numbers included in arrays or linked list. And two separate arrays, one for anchor points and one for the control points, with just Point Objects were fastest (if I remember correct) way but still that 120 m/s slower than Drawing API in Flash.My function in the class where something like:
ActionScript Code:
public function drawShape(points1:Array, points2:Array, lineOn:Boolean = false, fillOn:boolean = false, lineThickness:Number = 1, lineColor:uint = 0, lineAlpha:Number = 1, fillColor:uint = 0xff, fillAlpha:Number = 1):void{[code]..........
if you look at [URL] and check out the amazing background it has! how to place flash background, i know how color changing works, but how does the flash draw the randomly curved lines with gradient, and moves up and down? here is the link to the background flash [URL] as far i can tell, the lines are done purely in action script, because the whole thing is only 47kb
View 5 RepliesAs a UI specialist, I am often asked to build tool-tip displays and other sorts of popups that display text. One of styles clients seem most keen on is text in a comic-book balloon. I would like to create this balloons programmatically (as opposed to embedding or linking to rendered graphics), because these balloons will have to change size at runtime, depending on how much text they have to hold.
Balloons are easy to draw for the most part: circles, rectangles or rounded-corner rectangles. The tough part, for me, is the tail (the little arrow-like part of the comic balloon that points towards the speaker). If you google comic balloon, you see that there are many varieties of tails. They ones clients request from me most often are curved. E.g...
[URL]
The tail will always be on the bottom of the balloon, and it will sometimes point left and sometimes point right. I have been trying to come up with tail-drawing algorithms for a while, but I'm not happy with the results. I'm basically stumbling around in the dark, changing variables, looking at the results, and using trial and error to try to move closer to the magic numbers that will work. "Work" just means a result that looks pleasing, which I realize is subjective. Most of my clients will be a happy with anything that looks reasonably good and professional.
I want this result to scale. And it would be great if it could work with as few inputs as possible, maybe just isFacingLeft, tailWidth and tailHeight (Which could maybe be a percentage of the whole balloon). Maybe an adjustable curveAmount.
If it matters, I'm using Flash/Actionscript, but any system that has some sort of turtle graphics engine should work pretty much the same way: I'm working with that standard flipped Cartesian grid (y increases downward), x and y coordinates, the ability to move a pen, draw lines and draw curves.One caveat: Flash only allows me to draw 3-point bezier curves -- start point, control point, end point.
Note: balloons won't have to scale after the are drawn.
I have a hittest code that's supposed to prevent an mc from moving into a space occupied by another mc. The thing is, the first mc is inside another mc and for some reason the hittest isn't registering. The code I'm using is below. Is it wrong somehow, or is there another code I should be using?
Key.addListener(keyListener);
this.onEnterFrame=loopF;
function loopF() {
[code]...
I'm currently programming in AS 2.0, and I'm trying to get a piece of code to work. I have a movieclip that is deployed when the user clicks a mouse button, sort of like a bombshell being dropped on an area.
However, when I run it, it's quite obviously only registering one of the hitTests, because _parent.sprite_counter only decrements by one, regardless of how many enemies are destroyed. That's the other weird thing; no matter what, even if the counter never decrements, the movieclip still is removed.
Is it because you've got several movieclips simultaneously trying to decrement the same variable?
Ive got this script. when u press a button u can create a movie clip called man. when u press another button u can create one called enemy. thay both create at different sides of the seane and thay walk past each other.but when thay touch each other thay should go to frames inside them. ect Attack,Die.
var mans = 0;
function addman() {
if (Gold>=10) { [code]....
I have many, potentially hundreds, of objects that are floating around the screen. These objects are named "Object1", "Object2", "Object3" and so on. Another object is moving around the screen and if it hits any of the other objects, it destroys them. The thing is, if I have a loop like:
Code:
for(var i = 0; i < ObjectCount; i++)
where ObjectCount is subtracted off each time an Object is destroyed. Now say Object1 is removed, then the loop will fall short and not check for a collision for the Object with the highest number. The way I am dealing with this at the moment is I am looping through the initial number of objects and not subtracting off ObjectCount, so when there is only say 10 of an inital 100 objects left, it is still looping through all 100.
Here is what the principle of it is:
Code:
for(var i = 0; i < ObjectCount; i++)
{
CurrentObject = GameArea["Object"+i];
[Code]......
And as you can see, if Object1 is removed, then the Object with the highest number on it will not be checked.
I have 9 static movieclips arranged in a 3 by 3 grid, and 1 movieclip that moves using keypresses (invisible_mc)[code]when a hitTest is registered between the invisible_mc and any of the icon_mc's, The icon_mc goes to and stops on frame 2..else it goes to and stops on frame 1. I have constructed the hitTest as follows.is there anyway to reduce the endless repetition of code? [coe]
View 1 RepliesI have a bullet movieclip and it moves. I've put a hitTest on its onEnterFrame so that it checks if it hits its target, whose instance name is mmbug and the target flies around. That's easy and works cool.[URL]there's only one wasp present at a time and it works)Now what I want to do is duplicate the wasps so there are more flying around at one time, but how would I do the hitTest on the bullet then, because you have to specify it an exact instance name. If I make all the wasps have the same instance names it doesn't work.So obviously I'd have to give them names of mmbug1, mmbug2, mmbug3 etc. But how would I check on the hitTest if it hits any of them, since you have to put in an exact instance name in the hitTest?
View 5 RepliesI've been reading up and looking at examples of how to handle multiple hittests. So far in my example I have failed.
[Code].....
Basically I want to be able to check for a hitTest against all the bullets on stage against all atoms created. I attempted to do this with two for loops and it didn't work
For instance, I have a bullet movieclip and it moves. I've put a hitTest on its onEnterFrame so that it checks if it hits its target, whose instance name is mmbug and the target flies around. That's easy and works cool. ( see [URL] , there's only one wasp present at a time and it works) Now what I want to do is duplicate the wasps so there are more flying around at one time, but how would I do the hitTest on the bullet then, because you have to specify it an exact instance name. If I make all the wasps have the same instance names it doesn't work. So obviously I'd have to give them names of mmbug1, mmbug2, mmbug3 etc. But how would I check on the hitTest if it hits any of them, since you have to put in an exact instance name in the hitTest?
View 5 Repliesi got this flash with duplicated mc's say...enemy1, enemy2, enemy3. now we all know we can do something such as..
if {_root.blah.hitTests(_root.enemy)){_root.enemy.nextFrame();}}
because the enemy is duplicated and its no longer "enemy" but enemy12 or ****.is there any way to ...create multiple enemies and be able to do hitTests against them somehow.Also im not really a fan of attachMC
Is it possible to check if a movie clip hittests anything on the screen?
View 1 Replies[code]....
3.Image Viewer;When the image viewer is opened the image viewer window opens.When images are loaded into the viewer and captions are added they appear to work in Dreamweaver but they dont move in sequence when the buttons are clicked.In browsers the captions dont appear. If the window is closed and reopened all of the images have disappeared and just the image viewer returns.The response I got from an inquiry to Adobe was; The version of Dreamweaver has been discontinued and is no longer supported via phone or web cases. We only support versions CS3 andCS4 via telephone or web. have interoperability between these two programs?
converting flash 8 files to mx 2004? i have flash 8 files, but only have Flash mx2004 on my computer at home
View 1 RepliesI imported a panorama .jpg file (i.e., several overlapping landscape photos stitched together) onto the Flash MX 2004 stage, changed it to a symbol (graphic), and used Tween to simulate the panorama panning back and forth. The effect looks great when I click on the .swf file in Windows Explorer, but when I created a box on a PowerPoint 2000 slide and linked the .swf file to it, instead of the graphic, there is a red rectangle. The rectangle moves the way the graphic would, but you cannot see the photograph. By the way, I followed the steps at [URL] to link the .swf file to the PowerPoint slide.
View 1 RepliesI'm creating a simple game called shape wars. The game is shooting game where a blue cube(the player) fires blue shapes at the enemy(the red cube). The red cube also fires red shapes at the blue cube.Here is my code for duplicating the red shapes (this code is contained within the enemy)
onClipEvent (enterFrame) {
//attack
att = random(6);
if (att == 1 && dead == false) {
_root.redBullets++;
[code]....
is there any way to make splash screen [ means ist frame should stay sometimes and should jump to another frame] in flash mx 2004.
View 1 Repliesi have some problems in integrating with my own flash. 1st of all.. let me define the key things
1st step.. the flash will detect the xml. 2nd, it detect whether if it has people on air on the studio or not refer to the time. 3rd, if its between the [timeid] range ( 0-7) it has a slot but either has a dj or not, if the timeid = 8 , no slot and no deejays here is my core part of problem..
the flash will show the slot language pics background = MC ( session ), the slot name = dynamic text area ( slonem ), and who's the deejays = dynamic text area (djnem), of the current time, if there's no one on air or no slot , the pics background = MC ( session ) will show music only.
i'll include also my xml file and my dummy file for this thing.. also iincluded is the original schedule that working properly.. the original schedule and the dummy is basically different just they read from same xml file..
i just learn xml just a few months back then also with action script with help from my roomate [URL]..
I'm a former Flash 3 user that's desperately trying to get back into Flash with MX (not 2004) and need some assistance.I have been working through some 3D/perspective tutorials lately and have gotten stuck at trying to modify one of Senocular's great open source files from a tutorial covering Shape Movement vs. Camera Movement.
In the field of stars example at the bottom of this page, there is a scaling/easing/perspective effect that I am attempting to get a grip on.I moderately understand all the code that was provided in the "PullThroughSpace" FLA, but I need to modify it to do the following, which is where I get stuck:
1. Instead of duplicating the "stars" MC a set number of times, I wish to have five (just an example number) individual movie clips appear.
2. As opposed to random placement of these clips a la "PullThroughSpace", I wish to be able to define the spots myself.
3. Also NOT having them repeat when brought out of view. Similar to sofake, but with the addition of perspective. Also refer to bit-101's April 24, 2003 experiment.
4. Have buttons that, on release, will take you to a specific movie clip in this virtual field instead of having to click on the clip itself. Again... somewhat similar to the sofake design.
i have some problems in integrating with my own flash.1st of all.. let me define the key things
1st step.. the flash will detect the xml
2nd, it detect whether if it has people on air on the studio or not refer to the time.
3rd, if its between the [timeid] range ( 0-7) it has a slot but either has a dj or not, if the timeid = 8 , no slot and no deejays
the flash will show the slot language pics background = MC ( session ), the slot name = dynamic text area ( slonem ), and who's the deejays = dynamic text area (djnem), of the current time,if there's no one on air or no slot , the pics background = MC ( session ) will show music only.i'll include also my xml file and my dummy file for this thing.. also iincluded is the original schedule that working properly.. the original schedule and the dummy is basically different just they read from same xml file.i just learn xml just a few months back then also with action script with help from my roomate.
I am trying to finish up a project and run into this problem, right now I am trying to create a drag and drop game and on the last game you can dropparts into the others, what I want to happen is that when all are in the correct spot gotoandplay next frame. This is my current code,
if(one_mc._droptarget=="/onedef_mc" && two_mc._droptarget=="/twodef_mc" && three_mc._droptarget=="/threedef_mc" && four_mc._droptarget=="/fourdef_mc" && five_mc._droptarget=="/fivedef_mc" && six_mc._droptarget=="/sixdef_mc" &&
[code]....
everything was going well with my form until I transfer the files (php + swf) to a Windows server...the thing is that now it doesn't work.
View 14 RepliesIs there any reason for this.why text scroll bar is not in flash mx 2004?
View 1 Replieshow to create a healthmeter in flash mx 2004?
View 5 RepliesI am creating a Flash program that consists of a "master" movie file that will call in individual chapters (*.swfs) as needed. I want to create a single (page) navigation structure that will reside in the master - yet allow the user to go to the next/previous screens in the movie currently being used. I have created the master movie and have placed an empty movie clip on one of the frames. From the main navigation, I have been successfully able to load the individual *.swfs into the empty movie clip when called from the menu using the following command: _root.emptymovieclipname.loadMovie("external.swf");
I have been unable to figure out the action script that will allow me to control the navigation within the external swf from the main timeline. Also - is it possible to determine the number of frames within each clip as they are called so I can turn on/off the fwd/back buttons when appropriate?