The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.39 / 5.00 38,635 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.09 / 5.00 15,161 Viewshere is the .fla
File: http://spamtheweb.com/ul/upload/170209/6 8067_version2.fla
it seems that the ball when falling registers a hittest when it is still a little bit above the ground. you may need to slow down the frame rate to see it clearly, i will post the script here too:
function physics() {
ball.yv += GRAV;
ball.prepos.y += ball.yv;
//checking if predicted location is outside boundaries
if (ball.prepos.y>=YMAX-ball.radius) {
checkbounds(1);
} else {
update();
}
}
//checks the boundaries of the document
function checkbounds(cause) {
//hits the bottom
if (cause == 1) {
ball.yv *= -1*BOUNCE;
ball.prepos.y = YMAX-ball.radius+1;
}
}
//this updates player position if all hittests are finished
function update() {
ball.pos.y = ball.prepos.y;
ball._y = ball.pos.y;
ball.pos.x = ball.prepos.x;
ball._x = ball.pos.x;
}
//world constants
GRAV = 0.2;
BOUNCE = 0.3;
FRICTION = 0.05;
//world boundries
XMIN = 0;
XMAX = 400;
YMIN = 0;
YMAX = 400;
//ball velocity
ball.xv = 0;
ball.yv = 0;
//current position
ball.pos = {x:170, y:80};
//predicited position
ball.prepos = {x:this._x, y:this._y};
//radius
ball.radius = ball._width/2;
//get a demo tile
_root.attachMovie("tileMc", "tile", _root.getNextHighestDepth());
tile.gotoAndStop(2);
tile._x = XMAX/2;
tile._y = YMAX/2;
//start gravity
_root.onEnterFrame = physics;
let me know if you need more info on the problem, it should be very clear once you slow the framerate.
Thanks
Show us an example, a .fla is worth a million words.
upload it at spamtheweb.com
At 2/15/09 03:30 PM, frozenwave wrote: I made a little animation in flash, a loop so it just keeps going, but now i wanna add somme music but the problem is that every time the animation restarts the music restarts too...
Any code that can prevent that or so???
have the music enter on a specific frame(cannot be streamed). on the frame before that, or the end of the movie, have this code:
stopAllSounds();
well, i just completely went through a n example and have decided for practice that i will simplify it so it is much easier to understand. I will just start out with one preset level.
so what i am trying to do is a level code. this code would create a level determined by the numbers, is there any other way to do this?
so say i have this variable that equals a set of one digit numbers:
code="0110201"
what if i wanted to set another variable to one of the one digit numbers in the code, say the 4th number which is 0. how would i be able to do that? as2 please. would it be like this? newvar=code.4thnumber
wait, a minute, is there an as2 version, i only have flash 8!! if not, ill stick to flade!!!!
|-0
At 2/12/09 08:28 PM, Zuggz wrote: APE has about 15 or so files, and comes with the documentation.
Takes a few hours to understand everything you need to know.
Thanks
At 2/12/09 08:05 PM, Zuggz wrote: Just look at the documentation of one of the engines you keep getting links to.
Its not that hard.
well, what are some easy to rip apart as2 engines? I've been looking at flade, and there are like 50 different actionscript files that make no sense how they link to each other.
I know this has probably been asked hundreds of times, but just hear me out on this.
I wish to learn from a website how to make 2d engine quality physics. I don't need all the plug-ins or whatever, I just want to learn how to implement complete(circles, rectangles, triangles, joints, rotating joints, springs(if that's not too much) and motors) physics into a flash program. If after seeing this tutorial or whatever, and I decide to not to do it, I will stop bothering newgrounds with my physics questions. And I don't want a link to a 2d engine, I've already seen tons after spending several days on google trying to find a tutorial.
I don't want to sound like a brat or anything, but i am ready to give up searching for this incredibly rare tutorial.
Thanks to anyone who is willing to listen to me,
kylelyk
(crying inside)
At 2/5/09 11:36 PM, Murudai wrote:
If that's what you're after kylelyk then I can make a tutorial for you, though there are a lot of tutorials out there on this kind of stuff. Just look up 'momentum' and you'll find some great tutorials :)
i would love that!! i like to learn stuff through teaching, not by figuring it out through some one else's scripts.
pm me if you would be willing to do that!
Wow...... I am just blown away by the response while I was away at school. THAT IS AMAZING physics!!!! I have never seen anything more accurate and realistic acting objects. I might not start the programming, but I want to learn how the gravity works( besides the F=Gm1m2/r^2). I just love math because it can imitate anything and everything in this world and in the whole universe. I would love a tutorial!!!! I am also pretty good at tearing scripts apart(with some comments in them). eg unfinished .fl documents.
Thanks everyone for the amazing support. I was having a lot of trouble about a month ago when I was looking for help on this forum, but now its just great!!!
:D
I was wondering if there was a tutorial out there that could teach me how to program this kind of physics. I've been thinking about a puzzle game with level creator. Any ideas?
Click to view.
Just to let you know, I will not completely copy this game or idea.
At 1/10/09 04:13 PM, UnknownFury wrote: Td = Math.abs(Xd ^ 2)+Math.abs(Yd ^ 2);? Don't you mean: Td=Math.sqrt(Xd*Xd + Yd*Yd);?
ive tried both ways and it comes out the same, i actually traced the width of the arrow and the Td and they are the same. I've checked that the Xd and Yd are computing the right Td too. Its just the arrow's actual width is different than in real life(eg when you actully see it).
I am so confused why this is happening.
_root.onMouseDown = function() {
_root.arrow._y = _root._ymouse;
_root.arrow._x = _root._xmouse;
_root.onEnterFrame = function() {
Xd = _root._xmouse-_root.arrow._x;
Yd = _root._ymouse-_root.arrow._y;
Td = Math.abs(Xd ^ 2)+Math.abs(Yd ^ 2);
radAngle = Math.atan2(Yd, Xd);
_root.arrow._rotation = int((radAngle*360/(2*Math.PI)));
_root.arrow.long_part._width = Td;
};
};
this code runs the example here: http://spamtheweb.com/ul/upload/100109/5 0533_arrowexample.php
the length of the arrow end is not working properly, i used the Pythagorean theorem to figure out the distance between the arrow head and mouse so the arrow would be that long, but it is not working.
Any help?
Thanks.
got it, thanks: min.getNextHighestDepth
ok, so should just put a random depth in there are should i try still do get next highest depth, but different?
so what should i change?
you could use a movie clip and have on(rollover, press, rollout, and release) so it acts like a button, but is much easier to control.
so with this script, it should put 3 mcs inside of another mc. it only replaces them though so i only see the last mc on the list.
how can i fix this?
min = attachMovie("minion", "minion"+monsters_placed, _root.getNextHighestDepth(), {_x:40, _y:-20});
min.attachMovie("bottom_line", "bl"+monsters_placed, _root.getNextHighestDepth(), {_x:-6, _y:-8});
min.attachMovie("verticle_line", "vl"+monsters_placed, _root.getNextHighestDepth(), {_x:0, _y:-7});
min.attachMovie("middle_line", "ml"+monsters_placed, _root.getNextHighestDepth(), {_x:-3, _y:0});
well i knew i could put minion=attachmovie but i didn't know that i could do minion.attachmovie!
mc1.attachMovie("mc1","mc2",this.getNext HighestDepth);
that was what i was looking for!
ok so i have mc1 in the library. it has mc2 inside of it. when i attach movieclip to mc1, i can only give mc1 a name. i want to be able to give mc2 a name also.
thanks for actually listening to me!
heres all the keycodes
http://kb.adobe.com/selfservice/viewCont ent.do?externalId=tn_15887
why doesn't anybody know this? *sigh*
well, i gues nobody on this site knows how! oh well, aren't we all smart?!?!?
hello?
it not that hard of a question!
after making a button put this code into it
on(press){
nextFrame()
}
At 12/16/08 08:49 PM, CherinoGears wrote: K, Im working on making a simple platformer, to hone my skills in actionscript.
ive got ONE problem. The frkin player keeps fallin through the floor!
I got everything else to work, movement, running, all the animations n shit. i even put in a quick dash feature.
The player keeps going half way, then entirly through the floor. i cant put ma finger on it.
if (_root.ground.hitTest(_x,_y,true)) {
touchingGround = true;
} else {
touchingGround = false;
}
see im using boolean variables for the collisons so that gravity wont effect the character when touchingGround is true. I think of all things ive coded reguarding gravity and collisons, this is where the problem is.
perhaps i need to have the collison more defined by changing something in the _x,_y?
ill keep working at it but i must prepare for school in the morn, so i cant work on it much longer tonight. I would appriciate any help that you all could offer, thanks.
Your code is saying if ground thouched the origin of the player, which is one point, then stop doing gravity. it needs to be:
if (_root.ground.hitTest(this)) {
touchingGround = true;
}else {
touchingGround = false;
}