ActionScript 3.0 :: Power And Angle To Shoot The Arrow Back - Changing Distances Between The Player
Sep 24, 2010
So I've set myself a little project to build a bowman game. Everythings working smashing until the math at the point where the computer needs to figure out the power and angle to shoot the arrow back at you. What I've been working off is my knowledge from applied-math classes in school. I've been using the following formula where g is gravity, t is time (this would be in frames for flash), sx is the distance between the players, u is the initial force of the arrow and a is the angle we need to find. With a bit of moving around to seperate the angle, this becomes For my AS3 this translates to:
[Code]...
What happens is that it always fires the projectile at a very low angle that doesnt change to match the correct circumstances and I can't figure out how to get around this. Changing the force doesnt make any difference and the program will need to get around changing distances between the player so this math is pretty necessary (I think). Any math heads out there know what I should change?
I found a basic example of how to create something that'll shoot an object and create an arc based on an angle. I added a power Bar to it, but I noticed something bad about it.
The way it works the higher the speed is the further it goes and the faster it moves across the screen. This doesn't give me enough control. Because essentially I want fast moving projectiles but I want to also be able to shoot both near and far.
With this current system that's an impossibility.. Can anyone shed some light on how I can do this better? Here's the current way it's being done (important parts):
I'm doing a prototype game like Worms and I would like not only to shot, but also see the whole projection curve where my shot will travel before it hit the ground. The only information given by the player is an angle and a power. There is also some level elements like wind and gravity.
Can I have a code for the projection curve? its like a parabola I think. I research about parabola but I had some difficult to apply these math formulas into the programming code.
I am developing a game like this. [URL]. I just start this game And stuck in a problem. Moving arrow of game according mouse moveing like Given URL just check out. I know it is just a mathematical calculation. I have done according X position of mouse moving. But confuse something With Y position also. So I am not getting proper solution of X & Y position Both Togather.
Basically there will be a club and a ball. You can control the power and angle to hit the ball. How do I go about implementing this? Is flash the easiest way to go? I want to implement this as a facebook game. Any game libraries specific to this I can use to quickly implement a basic version? I am comfortable with Java and PHP.
I have been working on a tutorial in Flash on the topic of Flash () for two days, and I am just finishing up on a template. I have fixed five bugs, but I cannot think of how to fix this last one. I'd rather actually fix the problem this time, instead of improvising . So, here is what is going on:
I have this thing at the end where you have to enter in the code that I taught the viewer to proceed, then hit the continue button to finish the tutorial. But for some reason, whenever I try to go back with the back arrow, it does, but then I can't go forward with the forward arrow until I reach the first frame that contains actual tutorial ("page" 2). Then it works again. It seems really random, but there is [obviously] a good explanation for it. I thought it might have something to do with the fact that all of the arrows up to the "test" part, excluding the back arrow there, have the exact same instance name. However, "page" 2 is the 2nd time it is used (introduction, then the "page" 2, then 3, 4, 5, and 6, then the test part thing), so it makes less sense that it would work the 2nd time, but not the third, fourth, fifth, or sixth. And I know there's nothing wrong with the code itself:
How do I change the corner radius of a Label component in Flex. Tried applying style name, and the setStyle('cornerRadius',9) methods, but doesn't work. How can I change the arrow image in the combo box control to a different image?
I am having some dificulty making a path for this enemy i'm trying to create... cause i want him to rotate + move, then stop, then shoot, then rotate back and move off screen... Its easier if you see it.. you can download the swf file in the zipped archive to demonstrate what i mean. I did it there with tweens. Anyway.. i tried and make it but i'm a little stuck on the stopping part... you can also see what i did in the fla file attatched...
Is there a way to make it so that when you press the right key your animation/game goes forward a frame and when you press the left key it goes back a frame? I have a pretty minimal knowledge of actionscript so I'm not exactly sure how it would be done.
I have a Flex application using ActionScript 3.0. For any element in my application I want to set the mouse cursor to -- which is used specifically to indicate that a "move" or "drag" operation is allowed -- whenever the mouse hovers above the element
Is there a way to make it so that when you press the right key your animation/game goes forward a frame and when you press the left key it goes back a frame? I have a pretty minimal knowledge of actionscript so I'm not exactly sure how it would be done.
I'm trying to do a photo gallery for a website with scrolling arrows. I found a bit of AS that's perfect for what I want to do only problem is, it's in AS1 and i'm working in AS2 so i was wondering if someone could convert the code to AS2 for me or direct me to a tutorial that has the same sort of outcome in AS2.
My DateChooser code and its style code is shown below: <mx:DateChooser id="dc" cornerRadius="0" bottom="0" width="100%" allowMultipleSelection="true" allowDisjointSelection="false" styleName="dateChooserGradient" change="fetchDateAgenda(dc.selectedDate)"/>
And the dateChooserGradient: .dateChooserGradient { header-colors: #133c59, #29506c; todayStyleName: myTodayStyleName; headerStyleName: myHeaderStyleName; weekDayStyleName: myWeekDayStyleName; dropShadowEnabled: false; arrowBorderThickness:2; arrowColor: #062338; arrowAlpha: 0.1; } What I actually want for my arrows is a transparent background, with borderthickness to be 2, and the arrows and bordercolor to be #062338. Also if I can make the width and height of the arrow itself a bit bigger then what it is as default.
I wouldn't think this to be a very difficuly question to find a solution to. My question is; I have a movieclip with instance name "player" and I am trying to layout it's basic movement properties. I already have made it so that the mc will move up, down, left, and right. Cake. What I am having trouble with is getting the mc to rotate in the designated direction (right = 0 degrees, up = 90 degrees, etc).
I have tried using the xscale 100/-100 strategy, but that doen't do anything for up and down movements.
I know that I should use pythagore to calculate the distance, but I need to calculate distance between 2 objectfs that are contained within 2 different movie clips. Something in the line of :
But distancefromthis contains always the same value, maybe it's because _x is calculated within the movie clip, so I need to find the photo1.p1._x in the stage.
I have a series of variables created that store the distances between two points. I need to find the shortest distance between the two points so I'm storing the results in an array, then sorting the array to show me the smallest number which is the shortest distance. But the problem I have is that I don't need the number I need the variable in the calculation that relates to that number. Make any sense? So if the equation (herexPos - column3Begin) produces the smallest number I need to be able to reference column3Begin after I've sorted the array.
AS3 page with text links that change to a new color on mouse_over and change back on mouse_out. Sometimes the links do not change back and all remain colored after mouse-out. I have never been able to simulate the problem on my several computers at several locations but have seen it happen on the clients computers. Is there a known issue perhaps with Flash/AS3/Flash Player Version# that might cause this?
I've got a couple of MovieClips on my stage that use the onRelease event to run a function, this automatically makes the mouse cursor change to a hand symbol when over the MovieClip. That's all good, but I sometimes want to 'disable' my mouse, and when it's in this state I want to change the cursor back to a pointer. This should be handled in my controller, so having a statement around my onRelease function isn't ideal.
I set a variable var currentPage:String = "b1"; When I click a button, the click should change the variable currentPage to the event.currentTarget.name and it does
I've done the horizontal image panning tutorial on here and I was wondering what I need to change to make it vertical. Someone on here posted some code but it is in AS3 and I need it in AS2. Here is the code from the tutorial:
I'm working on implementing a fallback mechanism for the HTML5 video player. I've got a way to replace it with the swfobject Flash player, but how should I detect if any issues have developed?
In other words, if we use the following list of error events that can be thrown, which one should trigger the Flash player replacement? Or should we simply do a replacement if any error is thrown?
Also, where should the onError handler be called? I'm thinking on the video tag, but want to make sure.
I'm creating a video player that is linked with XML. Everything seems to work fine with no errors in the compiler, but my foward_btn and back_btn don't seem to do anything. It shows the trace "foward button" and "back button" but does not move to the next or previous video.
i am fading images into view using tweens, however the images flicker during the tween when i play them back in the flash player. Does anyone have any thoughts, advise, work-arounds?? Cheers
I'm looking to create a music player where one can upload songs from any computer on the web and play them back... is this possible and if so how would I go about creating it?
this is in my bullet movie clip on the timeline.[code]It all works but when i turn around it still shoots the same way im sure its something simple but i just cant work it out.
I am on mac and haven't upgraded my OS from 10.5 to 10.6 so when I upload a file creted in Flash CS5 it won't play because it needs the Latest flash player which uses 10.6 OS.So what I'm getting to is that can I go into "publish" settings and change the Flash player from 10.2 to an older version and then will this work.Also, which version should I change it to? For example sould I select Flash Player 5, 6, 7, 8, 9, 10 or 10.1?