Hi!
First I want to apologize for my language.
Nobody in my country can’t help me, so I turn to you for help.
I have 3 mc’s:
- cel (this is pointer)
- zaba (this is player)
- platforma1 (this is ball)
and 2 text fields.
AS in first frame:
poleSzerokosc = 500;
poleWysokosc = 500;
liczbaPlatform = 7;
predkoscPlatform = 0.5;
poslizgZaby = .3;
nazwaPlatformyRodzica = "platforma1";
for (i=2; i<=liczbaPlatform; i++) {
this[nazwaPlatformyRodzica].duplicateMovieClip("platforma"+i, i+400);
this["platforma"+i]._x = i*60;
this["platforma"+i]._y = i*70;
}
zaba.onEnterFrame = function() {
obrot = (_root._ymouse-this._y)/(_root._xmouse-this._x);
radiany = Math.atan(obrot);
stopnie = (radiany*180)/Math.PI;
stopnie += (_root._xmouse<THIS._X) p 0;< : 180 ?> this._rotation = stopnie;
this._x = this._x-(_root.poslizgZaby*(this._x-_root.cel._x));
this._y = this._y-(_root.poslizgZaby*(this._y-_root.cel._y));
// stop
if (Math.round(_root.poslizgZaby*(this._y-_root.cel._y)) == 0) {
this.gotoAndStop("stop");
_root.coTerazRobiZaba = "stop";
this.onMouseDown = function() {
cel._x = _root._xmouse;
cel._y = _root._ymouse;
};
}
if (Math.round(_root.poslizgZaby*(this._y-_root.cel._y)) != 0) {
this.gotoAndStop("skok");
_root.coTerazRobiZaba = "skok";
this.onMouseDown = null;
}
if (_root.wykrytaKolizja == "nie") {
if (Math.round(_root.poslizgZaby*(this._y-_root.cel._y)) == 0) {
this.gotoAndPlay("smierc");
this.swapDepths(200);
delete (this.onEnterFrame);
}
}
};
AS in cel mc:
onClipEvent (enterFrame) {
kolizja = false;
for (a=1; a<=_root.liczbaPlatform; a++) {
if (this, hitTest(_root["platforma"+a].platformaStop)) {
kolizja = true;
}
}
if (kolizja) {
_root.wykrytaKolizja = "tak";
} else {
_root.wykrytaKolizja = "nie";
}
}
AS in platforma1 mc:
onClipEvent (enterFrame) {
if (this, hitTest(_root.cel)) {
_root.cel.onEnterFrame = function() {
_root.cel._x = _root.cel._x+predkoscX;
_root.cel._y = _root.cel._y+predkoscY;
};
}
promien = _width/2;
x = _x;
y = _y;
if (predkoscY == null) {
predkoscY = (5+random(_root.predkoscPlatform*100))/100;
predkoscX = (5+random(_root.predkoscPlatform*100))/100;
skala = 90+random(20);
_xscale = skala;
_yscale = skala;
ruchY = random(2)-1;
if (ruchY == 0) {
ruchY = 1;
}
ruchX = random(2)-1;
if (ruchX == 0) {
ruchX = 1;
}
predkoscX = predkoscX*ruchX;
predkoscY = predkoscY*ruchY;
}
if (x<=promien+_root.predkoscPlatform) {
predkoscX = predkoscX*-1;
x = promien+_root.predkoscPlatform;
}
if (y<=promien+_root.predkoscPlatform) {
predkoscY = predkoscY*-1;
y = promien+_root.predkoscPlatform;
}
if (x>=_root.poleSzerokosc-promien-_root.predkoscPlatform) {
predkoscX = predkoscX*-1;
x = _root.poleSzerokosc-promien-_root.predkoscPlatform;
}
if (y>=_root.poleWysokosc-promien-_root.predkoscPlatform) {
predkoscY = predkoscY*-1;
y = _root.poleWysokosc-promien-_root.predkoscPlatform;
}
n = 1;
if ("platforma"+n != my_n) {
while (n<=_root.liczbaPlatform) {
nX = getProperty("../platforma" add n, _x);
nY = getProperty("../platforma" add n, _y);
n_radius = (getProperty("../platforma" add n, _width)/2);
deltaX = x+predkoscX-nX;
deltaY = y+predkoscY-nY;
if (deltaX*deltaX+deltaY*deltaY<(promien+n_radius)*(promien+n_radius)) {
x2 = eval("../platforma" add n add ":predkoscX");
y2 = eval("../platforma" add n add ":predkoscY");
predkoscX2 = predkoscX;
predkoscX = x2;
set("../platforma" add n add ":predkoscX", predkoscX2);
predkoscY2 = predkoscY;
predkoscY = y2;
set("../platforma" add n add ":predkoscY", predkoscY2);
}
n = n+1;
}
}
_x = x+predkoscX;
_y = y+predkoscY;
}
And this is work correct, but I need to make this jumping system
http://www.server.komrel.net/grzegorzY/1.swf
into this jumping system
http://www.server.komrel.net/grzegorzY/2.swf
Fla source:
http://www.server.komrel.net/grzegorzY/bounce_ball.fla
Can you modify AS for me?
I will be thankful for help.