ActionScript 2.0 :: Have An Enemy Square That Chases The Player Square?
Jan 15, 2010
I have this game, and some levels have a moving square as the player, you move the square with your arrow keys.... I want to have an enemy square that chases the player square.... They only chased mario when you didn't look at them? Kinda like that...... but in this regards:
I only want the enemy square to chase the player square when the player square moves.... soo say the player square moves 5 pixels per movement (know how to do all that), I want the enemy square to move when the player square moves..... towards the player square at like 7 pixels per movement..... so eventually you won't be able to avoid the enemy square....
I've been using flash for a whopping 3 days now, and I've stumbled onto a problem that I can't seem to find a way around. I'm using flash 4, due to the fact that #1 it's all I've got, and #2 the new flash mx 6 won't run on the old ass computer I'm using. This is my problem: I import a .bmp image and edit it in flash to make portions of it animated. The image is a symbol (I think it has to be anyway to animate it...) Everything runs fine when I use the basic play/rewind buttons to test the animiation, but when I make it into an executable, or when I go to the menu and hit "Test Movie", the image shows up as a red square. The animation I added still runs, but the actual image I imported is a red square.
When I'm working on the .fla I don't see anything unexpected, but when I view the .swf or export it there's a little red square in the animation. It moves with some of the stuff I have moving in the animation like they're attached somehow, but I can't find it in the fla to get rid of it.
if I set the stage to be 800 px X 800 px, it does not appear square, neither does holding shift + drawing a rectangle. However, drawing an oval and holding shift seems to create a circle(though it could be I can't notice it because it's too small). Is there some way to make these appear square?
I found the following code within a tutorial on the Kirupa website showing how to draw a square using ActionScript but I was wondering if it would be possible to modify this so that each line is animated in turn to construct a square (similar to the mouseover effect on the URL...website (right column 'Showcase' graphic)):[code]
This is my code: Code: var userData = new Array(); userData[0] = 100; userData[1] = 24; var dataLength = userData.length; for(i = 1;i < (dataLength + 1); i++){ _root.createEmptyMovieClip('box' + i, i + 999); ['box' + i]beginFill(0x000000, 100); ['box' + i]moveTo(0,0); ['box' + i]lineTo(100, 0); ['box' + i]lineTo(100, 100); ['box' + i]lineTo(0, 100); ['box' + i]endFill(); ['box' + i]_x = (i * 100) - 100; trace(['box' + i]); } What should happen is it displays 2 squares, one called box1, the other box2, but it only displays one, I think it is only displaying the second one.
How can I change the color of the border (i.e lineStyle) from 0xffffff to 0x000000 at runtime, so if a user clicks a button the color of the border changes from black to white.
I created a square using the rectangle tool, there are a few options on how to change it in the properties panel, however I don't see anything allowing to to round the corners of it. How do I do that? (I'm using Adobe Flash CS4 by the way.
1 is the main body of the website, and the other file has hundreds of layers that each contain some sort of code that imports XML and JPG images to create a slideshow. Now, I have created a grey square and then on playing of it I want the square to be replaced by this Slideshow, but still be able to apply some motion tweens like Fading etc in the main body.
I recently purchased a new Acer notebook computer for my business travel in late March 2011. The machine is running Windows 7 64bit OS and had IE8 64bit installed. I installed IE9 upon receipt of an update notice from Microsoft and downloaded Adobe Flash Player 'Square'. I am unable to view any internet video on news websites (ie: CNN, Fox, MSNBC, etc). The screen is completely blank, but does contain the audio. I do receive video for any 'You Tube' file I have attempted. I have removed and reinstalled both IE9 and Flash 'Square' multiple times after attempting various 'fix' I have found on line, but the problem persists and I cannot view video content. This is forcing me to use 'Chrome' when using this machine.
I am relatively new to flash. I am trying to create a square grid and add it to the movie.When I open the actionscript panel by pressing F9 and when I type the following code, var square:SquareClip = new SquareClip();addChild(square);
Things are working fine (the squareclip is appearing in the movie). Instead when I do this however, I deleted the above code and just create a new instance of Main,
import flash.display.Sprite; var bin:Sprite = new Sprite(); var cir:Sprite = new Sprite(); cir.graphics.beginFill(0x00ff00,1); cir.graphics.drawCircle(0,0,30); cir.graphics.endFill(); bin.graphics.beginFill(0xff0000,1); bin.graphics.drawRoundRect(40,40,100,100,5,5); bin.graphics.endFill(); addChild(bin); bin.addChild(cir); Here why do the circle added outside the square box?
simple code, to alpha out the square when clicked on. However, the release function keep getting called when the flash is started causes all the square alpha out.[code]
Normally when we draw a rectangle with linewidth 1 no problem.But if we apply a linewidth more than 10, the corners of rectangle seems rounded shape.[code]
I'm just learning how to use transformation matrices and i'm wondering if its possible to apply a transformation that pinches one end of a shape. i.e. transforming a square/rectangle into a trapezoid by pinching the top.
I am messing around to learn more about actionscript and I am trying to have a square movieclip resize itself so both sides are equal to 50 here is my code on the movieclip it does the resize and all but it keeps on going. I am not sure how to stop it.
I would like to link the red squares to the blue square in 3D with CS4 only (please no papervision or sandy...)I'm very closed to the solution but I still have a wrong z (visible when you move the mouse to a corner for instance)
i would like to know when a circle hits a square.Following code returns true when the rectangle of the MovieClip (blue) hits the square and not the circle itself:
circle.hitTestObject(square);
In as2 you had an extra parameter to indicate that.
[code]i use that to change it from a flat image to the prespective view, but i cant get the units to line up with there square anymore, i assume its since the Grid is at 200,200 and UnitLayer is by default at 0,0 but changes based on what square is in the middle of the grid (the data loaded from variables the squares in the Grid never changes positions)
I want to build a specifik thing in flash, and don't really know where to start.... Say I have:
3 images of 3 three different squares
3 images of 3 three different triangles
3 images of 3 three different circles
The first thing you see is Square 1, Triangle 1 and Circle 1. If you were to click on Choose Square, Square 2 will appare in Square 1s place. If you click on it one more time, Square 3 will appare, and then round again to Square 1. Same thing for all the shapes.When you're satisfied with your selection of shapes you click OK and then you get to see a movie, based on whatever choices you've made. Because there are 3 different shapes and 3 different objects within each category, there will be 9 different movies to watch (3x3=9).One example of how this could turn out is:
I have the starting point of a rectangle, and the rotation of the line that I would like this rectangle to be parallel to. My initial thought was to create a Rectangle() then rotate it, but there doesn't seem to be an easy method rotate a rectangle. From this rectangle I create I can obviously get the four points, but I need these to be adjusted based on an angle of rotation that I pass it.