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?

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Shoot An Object And Create An Arc Based On An Angle

Sep 21, 2009

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):

Code:
bullet = new Bullet;
this.stage.addChild(bullet);
bullet.speed = 1 + powerBar.scaleX * 20;

[Code].....

View 2 Replies

Actionscript 3 :: Shooting Projectiles Given An Angle And Power?

Dec 31, 2011

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.

View 1 Replies

ActionScript 3.0 :: Shoot Game - Moving Arrow According To X Position Of Mouse

Feb 25, 2010

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.

View 2 Replies

Java :: Get Started On A Simple Physics Based Game (with Angle / Power)?

Nov 28, 2011

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.

View 1 Replies

ActionScript 3.0 :: Go Back With The Back Arrow But Can't Go Forward With The Forward Arrow

Mar 5, 2011

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:

[Code]...

View 3 Replies

Flex :: Changing Cornerradius Of Label And Changing Arrow Of Combo Box

Aug 14, 2009

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?

View 4 Replies

ActionScript 3.0 :: Enemy Animation Sequence - Rotate + Move, Then Stop Then Shoot Then Rotate Back And Move Off Screen

Aug 10, 2009

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...

View 1 Replies

Flash8 :: Changing Frame With Arrow Keys?

Oct 28, 2009

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.

View 2 Replies

Actionscript 3 :: Changing Mouse Cursor To Arrow?

Sep 8, 2011

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

View 2 Replies

Flash8 : Changing Frame With Arrow Keys?

Mar 12, 2010

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.

View 2 Replies

ActionScript 2.0 :: Scrolling Arrows - Right Arrow Is The Same Just Changing Left For Right Obv

Jun 8, 2009

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.

[Code]...

View 2 Replies

Flex :: Changing Left / Right Arrow Button Styles For DateChooser?

Jul 25, 2011

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.

View 1 Replies

Player Face Direction Using Arrow Keys?

Jul 8, 2011

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.

My code so far is as follows:

Actionscript Code:
playerDirection = 0;setInterval(function () {if (Key.isDown(Key.RIGHT)) {setDirection(0);_root.player._x += 3;}if (Key.isDown(Key.LEFT)) {setDirection(1);_root.player._x -= 3;}if (Key.isDown(Key.DOWN)) {_root.player._y

[Code].....

View 4 Replies

ActionScript 3.0 :: Flash Player 10.2 Not Reading Arrow Keys?

May 31, 2011

The following code works properly in flash player 10.1 but not 10.2

ActionScript Code:
function setup() {
stage.addEventListener(KeyboardEvent.KEY_DOWN, displayKey);
}

[Code].....

View 0 Replies

ActionScript 2.0 :: Make The Bar To Move From Angle A To Angle B Smoothly?

Feb 9, 2005

Ive made this rotation with AS. But Id like to make the bar to move from angle A to angle B smoothly.

How can I do this?

View 2 Replies

ActionScript 3.0 :: Set Distances Between Text And Textfield Border?

Sep 15, 2009

I've used this property a lot of times before, but now i can't remember/find it on livedoc.

View 1 Replies

ActionScript 2.0 :: Distances Between 2 Objects Inside 2 Movie Clips?

Apr 13, 2006

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 :

xdist = Math.round(follow.p1._x - photo1_mc.p1._x);
ydist = Math.round(follow.p1._y - photo1_mc.p1._y);
distancefromthis = Math.round(Math.sqrt((xdist*xdist) + (ydist*ydist)));

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.

View 3 Replies

ActionScript 2.0 :: Math With Arrays And Stuff - Store The Distances Between Two Points

Apr 14, 2006

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.

[Code]...

View 14 Replies

Professional :: Changing Color On MouseOver And Back On MouseOut

Dec 22, 2011

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?

View 1 Replies

ActionScript 2.0 :: Changing Hand Cursor Back To Pointer?

Feb 14, 2008

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.

View 1 Replies

ActionScript 3.0 :: Variable Is Changing Back To Initial State

Jun 30, 2010

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

[Code]....

View 9 Replies

ActionScript 2.0 :: Vertical Panning - Changing All The X's To Y's But That Allowed The Image To Go Up And Not Back Down

Feb 16, 2011

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:

[Code]...

View 3 Replies

Flex :: Cannot Resize Player Back From Full Screen

Apr 15, 2010

The key event is not listened by my Flex app. Since it is really simple code, I cannot understand where the problem is...

init() {
stage.addEventListener(KeyboardEvent.KEY_DOWN, escHandler);
}

[Code]....

View 1 Replies

Web Development :: HTML5 Video Fall Back To Flash Player?

Jul 14, 2010

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.

[Code]...

View 1 Replies

ActionScript 3.0 :: Video Player - Forward And Back Buttons Not Working

Dec 21, 2011

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.

Code:
package {
import flash.display.MovieClip;
import fl.video.*;
import flash.events.*;
[Code] .....

View 0 Replies

Flash :: IDE - Images Flicker During The Tween When Play Them Back In The Player

Feb 10, 2009

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

View 1 Replies

Create A Music Player Where One Can Upload Songs From Any Computer On The Web And Play Them Back

May 31, 2011

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?

View 1 Replies

ActionScript 1/2 :: Bullets Only Shoot 1 Way?

Mar 4, 2012

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.

View 7 Replies

Professional :: Changing Flash Player In Publish Settings?

Nov 11, 2011

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?

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved