At 9/9/06 11:52 AM, mr_resident_evil wrote: hell ya man!
HA. Honestlly, it's such a good code. Although, it restricts you.. You must still know about AS to add enimies, power ups, health, etc.. so don't just make some lame game.
At 9/9/06 11:52 AM, mr_resident_evil wrote: hell ya man!
actually the MC that represents the character keeps falling threw the ground thing.
I think its an awsome code but I don't like that the Character can jump so far left and right, when in the air. I want to restrict him to only jumping a certain distance left and right can anyone help me with this problem?
This is the demo of my game:
http://media.putfile..m/unfinished-game-21
This is the code I have so far:
onClipEvent (load) {
fall = false;
_name = "circle";
jump = 0;
speed = 20;
jumpheight = 15;
maxfall = -54;
}
onClipEvent (enterFrame) {
xmin = getBounds(_root).xMin;
xmax = getBounds(_root).xMax;
ymin = getBounds(_root).yMin;
ymax = getBounds(_root).yMax;
if (Key.isDown(Key.SPACE) && fall == false && jump == undefined) {
fall = true;
jump = jumpheight;
}
if (jump<>undefined) {
if (jump>maxfall) {
jump--;
}
_y -= jump;
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_x -= speed;
}
if (Key.isDown(Key.RIGHT)) {
_x += speed;
}
}
Woah, isnt this topic over two years old?
nice codes.....how did you make it so you dont need instances?
oh, and watch out....there gonna be a butt load of nOObs making platformers
alot of blamin'
At 7/31/06 09:23 PM, yoshlan0440 wrote: no it's not rellay working for me and i'm using flash 8 pro and the cracater i had was half why trough the the rectangle stragely very stragely
srry for double posting but, its doing this cuz the registration is in the middle
ok if the characters falling through the block this might work for you.
put this in the character
onClipEvent (load) {
fall = false;
_name = "circle";
jump = 0;
speed = 8;
jumpheight = 18;
maxfall = -54;
}
onClipEvent (enterFrame) {
xmin = getBounds(_root).xMin;
xmax = getBounds(_root).xMax;
ymin = getBounds(_root).yMin;
ymax = getBounds(_root).yMax;
if (Key.isDown(Key.SPACE) && fall == false && jump == undefined) {
fall = true;
jump = jumpheight;
}
if (jump<>undefined) {
if (jump>maxfall) {
jump--;
}
_y -= jump;
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_x -= speed;
}
if (Key.isDown(Key.RIGHT)) {
_x += speed;
}
}
and then put this in the block
onClipEvent (load) {
activated = false;
down = false;
}
onClipEvent (enterFrame) {
_root.report.text = Math.round(_root.circle.yMax)+" "+Math.round(yMin);
xmin = getBounds(_root).xMin;
xmax = getBounds(_root).xMax;
ymin = getBounds(_root).yMin;
ymax = getBounds(_root).yMax;
if (_root.circle.xMax>xMin && _root.circle.xMin<xMax && _root.circle.yMax<yMin) {
if (_root.circle.yMax-_root.circle.jump*2>yMi
n) {
_root.circle._y = ymin-_root.circle._height/2;
_root.circle.jump = undefined;
_root.circle.fall = false;
activated = true;
}
}
if (Math.round(_root.circle.yMax)>Math.round(
yMin)) {
if (hitTest(_root.circle) && _root.circle.xmax<xmin) {
_root.circle._x -= _root.circle.speed;
}
if (hitTest(_root.circle) && _root.circle.xmin>xmax) {
_root.circle._x += _root.circle.speed;
}
if (hitTest(_root.circle) && _root.circle.ymin>ymax && _root.circle.jump>-1) {
_root.circle.jump = -1*(_root.circle.jump);
}
}
if (activated == true && not hitTest(_root.circle) && _root.circle.jump == undefined) {
_root.circle.jump = 0;
activated = false;
}
if (hitTest(_root.circle) && _root.circle.ymax>ymin && _root.circle.jump<>undefined && _root.circle._y<_y) {
_root.circle._y = ymin-_root.circle._height/2;
_root.circle.jump = undefined;
_root.circle.fall = false;
activated = true;
}
if (_root.circle.ymax-_root.circle.jump>ymin && _root.circle.xMin<xMax && _root.circle.xMax>xMin && _root.circle.jump<>undefined && _root.circle._y<_y) {
_root.circle._y = ymin-_root.circle._height/2;
_root.circle.jump = undefined;
_root.circle.fall = false;
activated = true;
}
}
if this dont work i have no idea
i used tis i think a year ago when messing around. now im making a 2p fighting game and want to include this. is there anyway to get it to accept two movie clips? i tried messing around with it, and it failed most miserably
At 10/7/06 03:33 PM, Goldtop wrote: is there anyway to get it to accept two movie clips?
nevermind, ive got it. btw, for anyone else with this problem, i found several ways to do it, but the easiest by far is to copy the block, and paste it in its shadow (right click>paste in place) then go to its script, and replace all of the "circle"s or whatever you had, i had player1, with the instance name of your second player. the easiest way to do this is ctrl+f, type in "circle" in the "find" box and "player2"(or whatever the nstance name of your second guy is) and clikc replace all.
I got it to work in Flash 8 perfectly, and I applaud your brilliant code. I'm gunna spend the rest of the day making it works with one big block and can have slopes and hills :D.
When I jump off a block and then land back on it I fall right off. If I jump off it and land on another block. No problem. If I jump of that block and land back on the first block no problem. But if I jump and land on the same block I fall right through it
i'm having a really big problem. everytime i jump onto a different black, my character falls right through it. please help!
Download Fart Man on Google Play!
https://play.google.com/store/apps/details?id=com.GroovyVideoGames.FartMan
Yeah, it's doing the same thing for me, it lands fine originally, but if i try to jump or anything, it goes right through everything.
Haha, but I don't know if anyone checks this post anymore.
I use Flash Pro 8 and This is almost working, but the character goes halfway through the block and the stops.
It worked but I was wondering how would you make the screen scroll?
There is Heaven
There is Hell
And then there is Heck
yeah, I have always wanted it to scroll.
Lawl this thread is magical. Is it because the code is so long? :P
At 2/20/07 07:32 PM, Greth-of-choas wrote: It worked but I was wondering how would you make the screen scroll?
just make whatever you want to scroll into an mc, give it an instance of thing put a stop action in the first frame, and make an animation of it scrolling. Then put this tiny bit of code into the circle mc:
onClipEvent(enterFrame){
if(Key.isDown(Key.RIGHT)){
_root.thing.play();
}
if(!Key.isDown(Key.RIGHT)){
_root.thing.stop();
}
}
It will only scroll right though and it may make it completely not work, but probably not.
At 2/17/07 10:13 PM, blackqat wrote: I use Flash Pro 8 and This is almost working, but the character goes halfway through the block and the stops.
I have the same problem with the original code, when I use the one posted later on it falls out of the screen entirely.
:(
OK, so I made the MCs, used the updated scripts, yadaadada. Won't work. My circle guy falls through the platform. Rawr. Help meh pls.
At 7/4/07 03:29 PM, FamouslyFamous wrote: OK, so I made the MCs, used the updated scripts, yadaadada. Won't work. My circle guy falls through the platform. Rawr. Help meh pls.
This is old anyway. There are many other ways to do this without instance names. For instance, there is a name in there because _name = "circle" just automatically sets the heros name to circle. no instance names required indeed.
From what I gather, you need the code put on all platforms added, but I haven't check this thread or if the code works. I don't know if it works for sloped ground, but if I could automatically set names and say no instance names, anyone can.
_name has been in since Flash 6.
you can even use a for...in loop to loop through all instances in a master platform holder and just hitTest against any within range.
Either way copying and pasting is bad and I don't want to help I'm just telling you other possibilities.
Thanks for the script im still sorta a noob at flash XD
At 7/24/04 02:17 PM, Rystic wrote: ANYONE WHO HAS PROBLEMS GIVE ME YOUR E-MAILS AND I WILL SEND YOU THE WORKING FILE
That should do it...
infinitywraith
[ a t ]
gmail . com
At 7/17/07 10:49 PM, Sinvader wrote:At 7/24/04 02:17 PM, Rystic wrote: ANYONE WHO HAS PROBLEMS GIVE ME YOUR E-MAILS AND I WILL SEND YOU THE WORKING FILE
That should do it...
cheers
At 7/4/07 03:29 PM, FamouslyFamous wrote: OK, so I made the MCs, used the updated scripts, yadaadada. Won't work. My circle guy falls through the platform. Rawr. Help meh pls.
That's because (unfortunately) it doesn't work with any version of Flash above 6.
At 7/23/04 10:47 PM, Rystic wrote:
thnx... it was hard to make.. but i did it...
No you didn't, this was stolen from GAMECUBICLE. This tutorial has the original piece of code that you stole from. In the tutorial just click, *Flash> Actionscipt> Platform Game: very easy engine> Next,* and all the code is right there. Next time don't pretend that you made something that you didn't. I can't believe that you got away with it to, If I can tell someone about this I will.
Sorry about that, I just looked at the dates and discovered that this thread was made before the tutorial was. Sorry.
This would work on flash 8 right?
I might use this for my first game evar.