Drag And Bounce
i saw a cool effect at the misssixty.com site. there is an image that you can drag upwards, then you let go and the image falls down and bounces up again. the jumps get smaller and smaller like they would in the real world. any ideas on how to do this. or any tutorials would be great.
FlashKit > Flash Help > Flash ActionScript
Posted on: 08-23-2001, 04:39 PM
View Complete Forum Thread with Replies
Sponsored Links:
Drag And Bounce
i saw a really cool effect at http://www.missixty.com
there is a heart that you can drag up on the screen. when you let go, it realistically bounces up and down.
any ideas on how to copy this?
View Replies !
View Related
Drag And Bounce
hi, i'm trying to use a script that makes objects aproches to my mouse.
but i need them to bounce each other or they will get over each other...
here is the script...
Code:
onClipEvent (enterFrame) {
mix = this._x;
miy = this._y;
finx = _root._xmouse;
finy = _root._ymouse;
distancia = Math.sqrt((finx-mix)*(finx-mix)+(finy-miy)*(finy-miy));
if (distancia<100) {
_root.raya.moveTo(distx, disty);
_root.raya.lineTo(finx, finy);
distx = mix+(finx-mix)/6;
this._x = distx;
disty = miy+(finy-miy)/6;
this._y = disty;
}
}
thanks
View Replies !
View Related
Horizontal Drag & Bounce
I'd be very grateful to anyone who can suggest how i'd do this or even refer me to a tutorial :
I'm trying to create a ball (or anything) that is only horizontally draggable (no 'y' movement). This ball will always sit within a boundary or box. When it is dragged and dropped with a little force, it should slowly come to a stop along it's horizontal invisible path; use more force and it should bounce against the wall/or walls on either side, before coming to rest.
It does not need to come to rest at it's original position.
I hope it doesn't sound complicated, but trying to do it has proved a little tricky.
View Replies !
View Related
Drag (realistic Movement And Bounce)
i am trying to create the effect of a moving something around by dragging and giving it a realistic movement (accelerate decelerate on release, and a collision effect). sorta like on the webagent007 (http://www.webagent007.com) where u can drag the little boy who is confined to a box, and he bounces back and forth. someone please help, anyone have any tutorials! much appreciated!
View Replies !
View Related
Drag And Drop Bounce Back
I posted a query, somebody helped me with this code. Stupidly I deleted the e-mail message and I can't return to that person or even thank him.
If your reading this.
Thanks
I tried this code and it seems to do the opposite of what I want. I'm unfamiliar with (_parent. code) and tried to use movie code instead of MC code. It worked, but sometimes the name box movie clip would stick to the mouse pointer.
I've tried and tried get this to work. I (almost) give up.
onClipEvent (load) {
calfmovieX = this._x;
calfmovieY = this._y;
}
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
this.startDrag();
}
}
onClipEvent (mouseUp) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
this.stopDrag();
// see if the dropZone contains the center of this mc
if (_parent.calfbox.hitTest(this._x,this._y,true)) {
// center it on the drop zone
this._x = _parent.calfbox._x;
this._y = _parent.calfbox._y;
//this counter should be global, because it will count for all body parts in the movie.
counter = counter+1;
if (counter==12) {
gotoAndPlay(45);
} else {
// return it to its original location
this._x = calfmovieX;
this._y = calfmovieY;
}
}
}
}
View Replies !
View Related
Drag/drop Bounce Back (advanced)
I have a project that I am working on.
I need to have an effect like in http://www.zefrank.com (on the left side nav
section go down about 12 links to 'googly') or on
http://www.mjau-mjau.com/main.html the 'sticky buttons' (the link doesn't
work for me).
Here is what I want to do. I have a mc (cocoonmc) that I want to 'suspend'
from a 'line'. I want the user to be able to drag and pull the cocoonmc and
the line will 'stretch' and when they let go it will 'snap back' and bounce
and stuff. After a set period of time, I need to run another mc (escapemc).
How in the world do i do this?
Thanks.
View Replies !
View Related
Drag'n'drop Doesnt Bounce Back?
Hi ,
I'm using this code for a drag and drop game with 5 dragobjects and 10 dragzones. Everything is hunkydory except for dropping dragobjects outside dropzones ...they should move gracefully (with smooth programmatic movement) back to their original posititions stored in the variables :
myHomeX
myHomeY
Instead they run to the upper left corner. Obviously a bug. Please help :
(suggestions concerning for - loops etc. also most welcome)
best regards Theo
PHP Code:
function dragSetup(clip,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10) {
clip.onRollOver = function() {
trace(this.myHomeX)
trace(this.myHomeY)
}
clip.onPress = function() {
startDrag(this);
this.beingDragged=true;
};
clip.onRelease = clip.onReleaseOutside=function () {
stopDrag();
this.beingDragged=false;
if (eval(this._droptarget) == targ1) {
this.onTarget = true;
//this.gotoAndStop(2);
clip.myFinalX = targ1._x;
clip.myFinalY = targ1._y;
} else if (eval(this._droptarget) == targ2) {
this.onTarget = true;
this.gotoAndStop(2);
clip.myFinalX = targ2._x;
clip.myFinalY = targ2._y;
}else if (eval(this._droptarget) == targ3) {
this.onTarget = true;
//this.gotoAndStop(2);
clip.myFinalX = targ3._x;
clip.myFinalY = targ3._y;
}else if (eval(this._droptarget) == targ4) {
this.onTarget = true;
//this.gotoAndStop(2);
clip.myFinalX = targ4._x;
clip.myFinalY = targ4._y;
}else if (eval(this._droptarget) == targ5) {
this.onTarget = true;
//this.gotoAndStop(2);
clip.myFinalX = targ5._x;
clip.myFinalY = targ5._y;
}else if (eval(this._droptarget) == targ6) {
this.onTarget = true;
//this.gotoAndStop(2);
clip.myFinalX = targ6._x;
clip.myFinalY = targ6._y;
}else if (eval(this._droptarget) == targ7) {
this.onTarget = true;
//this.gotoAndStop(2);
clip.myFinalX = targ7._x;
clip.myFinalY = targ7._y;
}else if (eval(this._droptarget) == targ8) {
this.onTarget = true;
//this.gotoAndStop(2);
clip.myFinalX = targ8._x;
clip.myFinalY = targ8._y;
}else if (eval(this._droptarget) == targ9) {
this.onTarget = true;
//this.gotoAndStop(2);
clip.myFinalX = targ9._x;
clip.myFinalY = targ9._y;
}else if (eval(this._droptarget) == targ10) {
this.onTarget = true;
//this.gotoAndStop(2);
clip.myFinalX = targ10._x;
clip.myFinalY = targ10._y;
}else {
this.onTarget = false;
//this.gotoAndStop(1);
}
};
//the variables below will store the clips starting position
clip.myHomeX = clip._x;
clip.myHomeY = clip._y;
trace(clip.myHomeX)
trace(clip.myHomeY)
clip.onEnterFrame = function() {
//all these actions basically just say "if the mouse is up (in other words - the clip is not being dragged)
// then move the MC back to its original starting point (with a smooth motion)"
if (!this.beingDragged && !this.onTarget) {
this._x -= (this._x-this.myHomeX)/5;
this._y -= (this._y-this.myHomeY)/5;
//if the circle is dropped on any part of the target it slides to the center of the target
} else if (!this.beingDragged && this.onTarget) {
this._x -= (this._x - this.myFinalX)/5;
this._y -= (this._y - this.myFinalY)/5;
}
};
}
dragSetup(ting1,drop1,drop2,drop3,drop4,drop5,drop6,drop7,drop8,drop9,drop10);
dragSetup(ting2,drop1,drop2,drop3,drop4,drop5,drop6,drop7,drop8,drop9,drop10);
dragSetup(ting3,drop1,drop2,drop3,drop4,drop5,drop6,drop7,drop8,drop9,drop10);
dragSetup(ting4,drop1,drop2,drop3,drop4,drop5,drop6,drop7,drop8,drop9,drop10);
dragSetup(ting5,drop1,drop2,drop3,drop4,drop5,drop6,drop7,drop8,drop9,drop10);
View Replies !
View Related
Rotation Of Drag And Bounce Movie Clip
I currently have a script that allows beach balls to fall onto the stage and roll to a stop. I also have it so they can be picked up and thrown/bounced around the stage. But I can't seem to figure out how to get them to rotate. I got the whole clip to rotate, but it was continuous and it also made the bouncing continuous. I need to be able to have the ball rotate when in motion but stop rotating when it's at rest. Can anyone help?
Attach Code
if(!dragging){
_x=_x+xspeed;
if(_x+_width /2>rightedge) {
_x=rightedge-_width/2;
xspeed=-xspeed*bounce;
}
if(_x-_width/2<leftedge){
_x=leftedge+_width/2;
xspeed=-xspeed*bounce;
}
_y=_y+yspeed;
if(_y+_height /2>bottomedge) {
_y=bottomedge-_height/2;
yspeed=-yspeed*bounce;
}
if(_y-_height/2<topedge){
_y=topedge+_height/2;
yspeed=-yspeed*bounce;
}
yspeed=yspeed*drag+gravity;
xspeed=xspeed*drag;
}else{
xspeed=_x-oldx;
yspeed=_y-oldy;
oldx=_x
oldy=_y
}
View Replies !
View Related
Advanced Level Help Needed (drag/move/bounce)
(main code created and copyrighted by www.arseiam.com)
Looks like I am up to a challenge here.
I need to get an effect like this;
http://www.mxfiles.kneib.biz/drag_an...k_spezial.html
Anybody care to help me out? The code as I have it now looks really simple, let me elaborate as to what I think I need to do and the experts here can maybe tell me I am on the right or wrong track ...
This is the entire code from the first frame;
Code:
slices = _root.myImg._totalframes ;
initX = 0;
initY = 0;
// Mouse down event handler. Excecutes build function.
onMouseDown = function() {
build();
}
// Mouse down event handler. Excecutes kill function.
onMouseUp = function() {
kill();
}
function build() {
_root.initX = _root._xmouse;
_root.initY = _root._ymouse;
for(i=2;i<=slices;i++) {
duplicateMovieClip("myImg",i,i);
_root[i].gotoAndStop(i);
// moves masked imaged to be relative to base image
_root[i].inner._x = myImg._width/2-_root.initX;
_root[i].inner._y = myImg._height/2-_root.initY;
// Defines onEnterFrame event handler for each slice
_root[i].onEnterFrame = move;
}
}
function kill() {
for(i=2;i<=slices;i++) {
_root[i].onEnterFrame = bounce;
}
}
function move() {
this._x = _root.initX+(_root._xmouse-_root.initX)*(this._name)/50;
this._y = _root.initY+(_root._ymouse-_root.initY)*(this._name)/50;
}
function bounce() {
var speed = 4.9;
var viscosity = 6.51;
xpos = _root.initX;
ypos = _root.initY;
//X Pos
xdifference = xpos-this._x;
xvelocity = (xvelocity+(xdifference)/speed)/viscosity;
this._x += xvelocity;
//Y Pos
ydifference = ypos-this._y;
yvelocity = (yvelocity+(ydifference)/speed)/viscosity;
this._y += yvelocity;
}
This is a step in the right direction, but doesn't quite cut it. It should move in circles and a lot slower. All in all a lot smoother and infinite, not going back to the original x,y co-ordinates unless you put the mousepointer in the movie again.
The speed and infinite stuff should be doable, but the cos/sin stuff is something I have never actually done before.
:insert help smiley here:
Any ideas?
View Replies !
View Related
Drop, Bounce, Collide, Bounce?
Hi!
I'm trying to figure out how to get 2 (or more) movie clips to bounce off each other and it's a bit frustrating since I'm just learning HitTest etc.
What I have:
- I have 2 movie clips, a circle and a square.
- each movie clip has actionscript for the "falling" gravity to work.
- each movie clip has a button in it with actionscript for the dragging and releasing etc.
- When the movie loads, the circle and square drop from the top of the stage and bounce (using gravity etc).
- You can drag and "toss" each object and it will bounce off the sides and bottom of the stage.
What I'm trying to do:
1) I'd like the circle and square to bounce off each other when they collide just like they bounce off the sides of the stage (right now they bounce behind or in front of eachother based on their layer depths).
2) Also, but less important, I'd like them to bounce off the top of the stage too instead of flying up and out.
Questions:
- How do I make this work? I've seen many examples using HitTest etc on instances of one movieclip, but my movie clips need to be different since they will be turned into separate objects/graphics later (if that makes sense). Is this still a HitTest solution? I don't think so since I'm not really using HitTest to begin with? I've tried incorporating code from some of those examples, but it just doesn't work.
I've attached 2 files - one in Flash 8 format, and another in Flash mx2004 format so hopefully someone can open one of them, take a look at the code and give me some help.
I appreciate it
Peace,
Hondo311
View Replies !
View Related
Movie Bounce In Bounce Out
Hi
I want to make a menu that bounces in on key press (for ipaq ppc)and when pressed again with the stylus bounces back out. I am using Flash MX but can not get this to work. Any ideas gretefully received.
Thanks
View Replies !
View Related
Bounce, Collide, Bounce Again?
Hi!
Flash 8 Actionscript question:
I'm trying to figure out how to get 2 (or more) movie clips to bounce off each other and it's a bit frustrating since I'm just learning HitTest etc.
What I have:
- I have 2 movie clips, a circle and a square.
- each movie clip has actionscript for the "falling" gravity to work.
- each movie clip has a button in it with actionscript for the dragging and releasing etc.
- When the movie loads, the circle and square drop from the top of the stage and bounce (using gravity etc).
- You can drag and "throw each" object and it will bounce off the sides and bottom of the stage.
What I'm trying to do:
1) I'd like the circle and square to bounce off each other when they collide just like they bounce off the sides of the stage (right now they bounce behind or in front of eachother based on their layer depths).
2) Also, but less important, I'd like them to bounce off the top of the stage too instead of flying up and out.
Questions:
- How do I make this work? I've seen many examples using HitTest etc on instances of one movieclip, but my movie clips need to be different since they will be turned into separate objects/graphics later (if that makes sense). Is this still a HitTest solution? I don't think so since I'm not really using HitTest to begin with? I've tried incorporating code from some of those examples, but it just doesn't work.
I've attached 2 files - one in Flash 8 format, and another in Flash mx2004 format so hopefully someone can open one of them, take a look at the code and give me some help.
I appreciate it
Peace,
Hondo311
View Replies !
View Related
Bounce Down...?
I want to have an object drop down to like 200px from the top, not hit anything, but then realistically bounce up and down slower and slower, like you know... it doesn't just come down and thats it. Kind of hard to explain, but I hope you get it and can help! Thanks!
View Replies !
View Related
Bounce, C'mon Bounce
Hiya,
Pretty new to all this, but can somebody point me in the direction of anywhere that'll explain how to get objects of different dimensions to float around in a square/circle bouncing of each other and the walls. The bouncing bits need to be buttons, incidentally.
Thank you!
View Replies !
View Related
Bounce
Flash MX
ok, I want to do the simple task of, when an object moves, whenever it hits any other object, it bounces at the angle opposite frome whence it came. I also want to make the object move to begin with.
so, if there is a circle in the frame, and it hits the side at a 30 degree angle, it goes off at a thirty degree angle. Physics.
View Replies !
View Related
Bounce
cant get ball to bounce off of a wall on both side
its a short little wall in the center of my screen and i want the ball to bounce off of it on the left and the right side.
View Replies !
View Related
Get A Little Bounce (MX)
Hi all,
I'm rather new to all this and have what will hopefully be a straight forward question.
I want to animate an object, with actionscript, falling from the top of the screen to land with a bounce. No interactivty nothing.
Can any one point me in the right direction?
Thanks
View Replies !
View Related
Bounce
I really need help but I can't explain myself very well, so I will just send you to the swf file and maybe you can help me. here is the link: http://www.newgrounds.com/portal/view/174139 The problem is when you run into the planet, I want the ship to bounce off rather than stick in it like it is mud. I am simply implementing the use of two movement vars. (xv and yv) so currently, I just set them to zero. I have tried stuff like xv = -xv and I even tried the long way 'round if xv > 0 .....
If you have any suggestions please post them
thanks!
View Replies !
View Related
Bounce
Hello again, I had been making a simple game to practice my actionscripting,
It's a ball that moves with the direction keys,
What I did was make 4 separate Mc's as walls; top bottom left and right,
I was able to make the ball bounce from these Mc's by using hitTest and x / yspeed - x / yspeed*2,
that worked by making the ball "bounce" in the opposite direction at the same speed as when it hit,
I've now changed the walls into one wall, I've changed the code to x / y *= -1,
That inverts the direction BUT...
When it hits it goes literally opposite direction so x and y is inverted not creating the "bounce" effect.
Is there another way that this could be achieved?
Thank you in advance!
Attach Code
onClipEvent(load) {
speed = 3;
friction = 0.96;
yspeed = 0;
xspeed = 0;
}
onClipEvent(enterFrame) {
//calculationssss
_y += yspeed;
_x += xspeed;
yspeed *= friction;
xspeed *= friction;
_rotation += xspeed;
//movement
if(Key.isDown(Key.DOWN)){
yspeed += speed;
}
if(Key.isDown(Key.UP)){
yspeed -= speed;
}
if(Key.isDown(Key.RIGHT)){
xspeed += speed;
}
if(Key.isDown(Key.LEFT)){
xspeed -= speed;
}
if(_root.wall.hitTest(_x,_y, true)) {
yspeed *= -1;
xspeed *= -1;
}
}
View Replies !
View Related
Help With Slide And Bounce
I'm trying to make some text slide onto the screen and then bounce naturally when it hits its required position.
I would also like to fade it it as it slide.
I'm sure all this can be done with actionscript but all I get so far is the slide movement.
View Replies !
View Related
MC Bounce Around Screen
Im making a screen saver and I want MC to bounce around the screen. I search the movies and tutorials but the only one I found that was what I wanted did work for me.
Anyone know how to make MC bounce around the screen? There are 6 MC's. I need this ASAP.
View Replies !
View Related
How Do I Get An Elastic Bounce?
This might be a silly question: but, how do I get an elastic bounce?
I've seen it on many sites: you click on something, say for example, the object will bounce to and forth and come to rest. This all happening in half a second.
I could attempt to achieve a bounce with some tweening.
But, all the examples I've seen, seem to have a 'natural' elastic bounce. It's something that I can't create with a simple teen.
Does ANYONE know what I'm taking about?
Any help/pointers would be really appreciated.
Thanks.
Jam
View Replies !
View Related
The Bounce Of The Ball
Ok, it's me again. Hope no one minds me asking all these questions. I know how to make the ball move on a motion guide. But, I don't know how to make it look like a real ball. I fill it with a radial granet to simulate shadow. But as it moves the shadow should follow the light, and I don't know how to do that. Also, when it hits the ground it should smush a little before it bounces back up right? How do I make it smush and then unsmush? Please help.
View Replies !
View Related
Bounce In Boxes
How do you make bounce in Boxes? I've seen them used on TONS of web sites and they look neat
Incase you're wondering wtf I'm talking about, its like the box comes in, expands then shrinks to a normal rectangle like. I'll try to find an example
View Replies !
View Related
Adding 'bounce'
Right i have a movieclip (a plain square called 'box') a button (called button), and a script which enlarges the movie smoothly. But I want to add a 'bounce' effect so that when the move reaches its destination size it streches out a bit (gets bigger) then springs back to destination size. Kinda an elastic effect.
Here is the code:
Button code:
Code:
on (press) {
_root.box.change = true;
_root.box.goaly = 300;
_root.box.change = true;
_root.box.goalx = 500;
}
Movie code:
Code:
onClipEvent (enterFrame) {
if (change == true) {
_xscale += (goalx-_xscale)/3;
_yscale += (goaly-_yscale)/3;
}
}
If anyone can help it would be most appreciated
View Replies !
View Related
Bounce When Click
Hello.
I am trying to animate an MC instance named myName, Specifically, I am trying to make it bounce on a y point. I can't figure out why it is not working. Here is my code:
-- first frame action
g = 150;
elastic = .7;
BallRadius = getProperty("myName", _height)/2;
nameBounce = false;
-- button action
on (release) {
nameBounce = true;
}
-- MC action
onClipEvent (load) {
if (nameBounce) {
y = getProperty("_root.myName", _y);
vert = Number(vert)+Number((g/10));
y = Number(y)+Number((vert/10));
if (Number(y)>Number((200-BallRadius))) {
y = 200-BallRadius;
vx = (vx*elastic);
vert = -(vert*elastic);
}
setProperty("_root.myName", _y, y);
if (_root.myName_y==200) {
nameBounce = false;
}
}
}
Is the error in the logic or the syntax?
Thanks for any help you offer.
1M.
View Replies !
View Related
. . .add Elastic Bounce
Hello,
I'm trying to add an elastic feel to a MC that
grows when the Hit Test is activated, and shrinks back to it's original size when hit test is false. I'm using this code below which works perfectly, but I can't figure out how to add a bouncy elastic feel to it when it grows and shrinks back.
// control position of object
onClipEvent (load) {
ease = 5;
xmove = _x;
}
onClipEvent (enterFrame) {
_x += (xmove-_x)/ease;
}
// control scale of object
onClipEvent (load) {
scaleease = 5;
xscale = _xscale;
yscale = _yscale;
}
onClipEvent (enterFrame) {
_yscale += (yscale-_yscale)/scaleease;
_xscale += (xscale-_xscale)/scaleease;
}
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
_root.nav01.xscale = 1200;
_root.nav01.yscale = 7000;
} else {
_root.nav01.xscale = 100;
_root.nav01.yscale = 100;
}
}
View Replies !
View Related
How Do I Get An Elastic Bounce?
How do I get an elastic bounce at the end of an object coming onto screen?
I've learnt how to move an object using actionscript so that it eases in... but I've seen in many other websites where objects have a little bounce at the end before coming to a rest - HOW DO I DO THIS!?
Any help would be appreciated.
Thanks.
Jam
View Replies !
View Related
Bounce Effect
I have a simple box, Ive shrunken it before the movie loads, that when loaded, it maximizes the box to its original size... im trying to give it that bounce effect so when it maximizes it looks rubbery-ish..
View Replies !
View Related
Bounce Off Walls
hey guys, i've attached a file for you to look at. when you open it go to the "menu" scene (there's nothing in gameplay yet, but i will need your help there too probably in the future). in menu, see that little black ball on the right (frame 38)? can you show me what action to add to that ball to make it start from that point... pick a random direction to go in... and whenever it hits any of the walls to bounce back... i want it to just continue to bounce around the screen in the background. (of course though, i want it to bounce back continueing on at the angle it hit the wall from.... do you follow me? did i phrase that right? do you get why i'm TRYING to say?)
View Replies !
View Related
Bounce Animation
Hey all,
I am trying to achieve a good animation that makes it look as if the object is bouncing a little bit right before it locks into place. just a small bounce and i need it to be smooth. this is part of a menu that pops up is supposed to bounce a little and then stop in its place. what i have tried to do is create a motion tween of it going into place then moving backwars a little bit and then going back. i dont know if it matters but im doing this with a bitmap not a vector graphic. the way i have it going it looks very awkward and it moves very sporadicly sort of. is there a better way to achieve this effect. i hope you know what i am talking about at least maybe a little. thanks
Rob
View Replies !
View Related
Bounce Effect
Anyone know how i can create a simple basic bouncing box effect? Just want to create a box that you drag from side to side and it bounces off the vertical walls on either side......no 'up and down' bouncing just left to right.
View Replies !
View Related
MC Follows The Cursor With Bounce?
I know how to make a movieclip follow the mouse cursor around a movie, but what I need to do is more similar to the www.sobebev.com navigation bar. That is, the item following the cursor should be limited to one axis, have a bit of bounce or sassyness to it, and disappear once the cursor leaves.
Any ideas on what the actionscript/math for this would look like?
View Replies !
View Related
Slide In And Bounce?
I'm trying to create a simple effect where a MC slides in from outsid the stage and kind of bounces to a stop. It's the same idea as a bouncing ball but along the x axis instead of the y axis.
I've read through a ton of tutorials and samples but I'm just not getting it. So many of them have drag and throw or follow the mouse and I can't seem to take out what I don't need and keep the script working.
sorry. I'm guessing that elastic effects are THE most asked question on here.
EDIT:
Ok I found this and it works pretty good
onClipEvent (enterFrame) {
// MOVING SCIPT PART
var speed = 8;
var viscosity = 1.5;
// Where to go-----------------------------
xpos = 294;
// Move to xpos script-------------------
difference = xpos-this._x;
xvelocity = (xvelocity+(difference)/speed)/viscosity;
this._x += xvelocity;
}
I need to have another clip come in from the right though, how do I reverse the direction of movment? Also what do I change to make it zippier? I want it to realy go "SPROING!!!"
View Replies !
View Related
Adding Bounce
I am using this code to move MCs on the stage but I would like to add a nice bounce effect to it so that they actually go passed the set xy then spring back a few times until it reaches the correct position. Can anyone give me some ideas on how to add that to my code?
function moveMe() {
this.const = .3;
// difference of position
this.d_difx = (this.targX-this._x);
this.d_dify = (this.targY-this._y);
// set position
this._x += this.d_difx*this.const;
this._y += this.d_dify*this.const;
// shut this off
if ((Math.abs(this.d_difx)<=1) && (Math.abs(this.d_dify)<=1)) {
delete (this.onEnterFrame);
}
}
And here is how I tell the MC to move
mcName.targX = 0;
macName.targY = 499.75;
mcName.onEnterFrame = _root.moveMe;
Thanks,
View Replies !
View Related
Bounce Menu
Ello ..is there anyone know how to make such bounce
menu just like in this site..go to news section and u'll
see..
http://www.clcsarquitectos.com/main_en.html
it's really tweaking menu....any walkthrough or sample
would be great....
thnks in adv
View Replies !
View Related
Bounce While Being Moved
If I had a circle, and I wanted it to be controled by the arrow keys, but not just move right ot left, but to bounce while doing that, how would I do this?
Thanks
EDIT: It would be like a game where you can walk left and right and jump, but when it jumps, ther wouls be gravity
View Replies !
View Related
Bounce Or Damping?
I have this code on a movieclip which works nicely.
onClipEvent(enterFrame){
_x += (positionx - _x) * .2;
_y += (positiony - _y) * .2;
_root.but1.onPress = function(){
positionx = 18;
positiony = 18;
};
_root.but2.onPress = function(){
positionx = -550;
positiony = 18;
};
_root.but3.onPress = function(){
positionx = 18;
positiony = -400;
};
_root.but4.onPress = function(){
positionx = -550;
positiony = -400;
};
}
Do any of you flash gurus know how I might add code that would make the clip bounce a little rather than going straight into position?
Thanks in advance!
View Replies !
View Related
Bounce Effect
I'm trying to get a "bounce" effect on a movieclip when it scales. Right now I have it scaling smoothly but I would like it to "bounce" or scale a bit past it's intended point and back to the intended point. I hope this makes sense. Here's what the clipEvent on my clip looks like now and the button actions as well.
code:
onClipEvent(enterFrame) {
_xscale += (newScale - _xscale) / 3;
_yscale += (newScale - _yscale) / 3;
}
my_btn.onRollOver = function() {
myclip.newScale = 110;
}
my_btn.onRollOut = function() {
myclip.newScale = 100;
}
Thanks for any help
View Replies !
View Related
Bounce Off At Angle...
Hi guys...
I figure this one shouldnt be too hard.
What would be an ideal algorithm for having a ball bounce off a wall, when the rotation of the ball is given, and the direction that the wall is facing is given...
all i need is a script that takes the given direction of a ball, the given direction of the wall it has bounced off, and turns it into a new resulting direction for the ball...
looking at the directions i drew on the attached image, heres another example of some input and output.
ball_rotation = -25, wall_rotation = -180,
resulting_rotation = -155
ball_rotation = +45, wall_rotation = -135,
resulting_rotation = -135
(ie: ball simply reverses direction in this case)
ball_rotation = +135, wall_rotation = -90,
resulting_rotation = -135
does anyone know where I can get some good resources for this? or even make up a quick script demonstration?
also, if you're finding my explaination hard to follow, ill post an example in flash as soon as i can...
thanks guys
~theWaste
edit: image updated
View Replies !
View Related
Rollovers Bounce Around:
i made a button in mx 2004 and when i cursor over the up state the over state shows up not in the exact same place and the same for the down and hit states.
if u need more info please let me know. its not uploaded yet so i can't demonstrate. i've selected center horizontally and center vertically for all states.
don't know what i've done to have this result.
any advice would be great. thanks.
View Replies !
View Related
OOP Bounce When Hit Object
hi guys
I'm trying to extend a classic ball mover/bouncer class, so it doesn't only bounces of the stage area, but also whenever it hits any object on stage. I want it to be a realistic hitevent, so I use the bitmapData and point to register the outer border of the ball.
I can get 2 balls on stage to register a hit, but they move over eachother and goes a little from side to side before moving on in seperate directions. It's like the ball dont register the hit at the border of it self.
ActionScript Code:
import flash.geom.Point;
import flash.display.BitmapData;
class Hit extends Bouncer
{
var _thisBit:BitmapData;
var _objBit:BitmapData;
var _hitObj:MovieClip;
function Hit(targetMC:MovieClip, xVel:Number, yVel:Number, hitObj)
{
super(targetMC, xVel, yVel);
this._hitObj = hitObj;
this._thisBit = new BitmapData(this._targetMC._width, this._targetMC._height, true, 0);
_thisBit.draw(this._targetMC);
this._objBit = new BitmapData(this._hitObj._width, this._hitObj._height, true, 0);
_objBit.draw(this._hitObj);
}
function startMoving():Void
{
this._targetMC.updatePosition = this.updatePosition;
this._targetMC.bounceAtBorder = this.bounceAtBorder;
this._targetMC.bounceAtObject = this.bounceAtObject;
this._targetMC.onEnterFrame = function()
{
this.updatePosition();
this.bounceAtBorder();
this.bounceAtObject();
}
}
function bounceAtObject():Void
{
if(this._obj._thisBit.hitTest(new Point(this._x-(this._width/2), this._y-(this._height/2)), 10, this._obj._objBit, new Point(this._obj._hitObj._x-(this._obj._hitObj._width/2), this._obj._hitObj._y-(this._obj._hitObj._height/2)), 10))
{
this._obj._xVel *= -1;
}
}
}
I really hope somebody can help me out here...
View Replies !
View Related
Looking For A Bounce Script
Hi, I'm new to flash. I've made games before with gamemaker - http://www.messhof.com/games/?id=games and I'm trying to move over to flash. The nice thing about gamemaker is all the included scripts that take care of the everyday necessary actions needed in games, one being bouncing realistically off angled (or curved) surfaces.
Here is my game so far (not much to it) - http://messhof.com/boolflash.html
Arrow keys control the white ball.
Right now my walls are just vector shapes (I drew them with lines, filled them in, then deleted the lines) all contained in one movie object.
I used the hitTest function to test four points on the player's circle, and reverse the x or y speed based on which point has a collision with the wall object. This is fine for horizontal and vertical walls, but the game would look pretty dull if there were only rectangular obstacles.
I'd like to have the ball bounce realistically (or close enough) off angled surfaces. And I'd like to be able to just draw the surfaces, rather than place each 45 degree angle piece. There must be a way to find the angle of a side of a vector shape.. isn't the information for drawing them stored in a set of angles?
Does anyone have a script like this that I can just plug in? It's not a major part of the game, since you're supposed to avoid hitting the walls, so it's frustrating that this has been holding back the project for so long.
Any help is GREATLY appreciated.
View Replies !
View Related
Bounce In A Circle
Hi,
First, excuse my crappy english, I will try to make my best:-)
I am graphic designer, no developper at all, and quite newbie in AS, except for the simple usual things. And I am really a moron in math
I would like to make a MC bouncing into a circle and I can't...
I read several tutorials about collisions, searched a lot, but no way... I understand when it's in a square, with "walls", but I can't make something realistic with a circle and all these ****ing Math.tan and cie...
Could someone help me, or give an exemple?
Thanks a lot
View Replies !
View Related
|