At 3/6/05 06:44 PM, Rystic wrote:
At 3/3/05 11:26 PM, The_Mercenary wrote:
god damn its that much of a pain in the ass just use my engine, sorry to sound like an asshole there but come on, its simple and there is no shit like that happening, if you dont want to then its fine. BTW, for the 45 degree angle thing
just take the code I posted for the slant and put it after "if(......_y, true) put it here )"
"and !this._rotation<-45"
Geez, Mercenary. It's not that big a problem. All you have to do is center the clip.
Yea I know, sorry dude, I was getting carried away there. Now I'll actually post the script to my platform engine here.
Make a bunch of platforms, and make all of them into one big movieclip and give it the instance of "ground" and then put this code in it:
onClipEvent (load) {
_root.falltime = 0;
groundspeed = 10;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.SPACE) && !jumping) {
vel_y = 38;
jumping = true;
_root.character.gotoAndStop("jumpframe#");
}
if (jumping == true) {
vel_y -= 2;
if (vel_y<=-15) {
vel_y = -15;
}
if (vel_y<15) {
_root.character.gotoAndStop("fallingframe#");
_root.falltime2++;
}
this._y += vel_y;
}
if (this.hitTest(_root.character._x, _root.character._y+18, true)) {
vel_y = 0;
_root.character.gotoAndStop(1);
_root.falling = false;
_root.falltime = 0;
jumping = false;
} else {
this._y -= 20;
_root.falltime++;
if (jumping == false and _root.falltime>=5) {
_root.character.gotoAndStop(3);
_root.falling = true;
}
}
}
onClipEvent (enterFrame) {
if (_root.scrollleft == true and _root.stopscroll == false) {
this._x -= groundspeed;
} else if (_root.scrollright == true and _root.stopscroll2 == false) {
this._x += groundspeed;
}
if (this.hitTest(_root.character._x, _root.character._y, true)) {
_root.ground._y += 5;
}
}
then make a character and give it the instance of "character" and put this code in it:
onClipEvent (load) {
speed2 = 8;
_root.scrollright = false;
_root.scrollleft = false;
_root.stopscroll2 = false;
_root.stopscroll = false;
boundry = _x=100;
boundry2 = _x=325;
}
onClipEvent (enterFrame) {
if (_root.ground.hitTest(this._x+30, this._y-25, true)) {
_root.stopscroll = true;
} else {
_root.stopscroll = false;
}
if (_root.ground.hitTest(this._x-30, this._y-25, true)) {
_root.stopscroll2 = true;
} else {
_root.stopscroll2 = false;
}
if (Key.isDown(Key.RIGHT) && !_root.ground.hitTest(this._x+15, this._y-25, true)) {
_xscale = 100;
if (this._x<boundry2) {
this._x += speed2;
} else {
_root.scrollleft = true;
}
} else if (Key.isDown(Key.LEFT) && !_root.ground.hitTest(this._x-15, this._y-25, true)) {
_xscale = -100;
if (this._x>boundry) {
this._x -= speed2;
} else {
_root.scrollright = true;
}
}
}
onClipEvent (keyUp) {
if (Key.getCode() == Key.RIGHT) {
_root.scrollleft = false;
} else if (Key.getCode() == Key.LEFT) {
_root.scrollright = false;
}
}
There thats all, now you have a game. Just dont use this code and submit it as a game, make something cool out of it. And make your characters "+" be at where his feet are so that he lands on the platforms right.
This engine isnt exactly the most perfect for pixel perfect platforming, but this is more like a ready-to-go thing, this can be use for alot of types of games, any sidescroller basically. And Rystic, you can try to mod if you want.