![]() |
![]() |
#25 | |
Process Fan
Join Date: Jun 2007
Posts: 32
|
Re: TF Flash Game
Quote:
looking at it right now you probably have a line that looks something like this that stops you from falling. if(this.hitTest(_root.ground)){ yspeed = 0; } because of that when it reports you are touching ground, you stop falling, but you also stop at the xy corespondents you actually hit the ground. now the better method of doing it, the relevant parts are as follow. do your speed calculations like you already are. before doing the hit detections add the forecast_x = this._x+xspeed; forecast_y = this._y+yspeed; lines of code, this sets forcast_x and forcast_y to where the player is going to be on the next frame. next you want to check if there inside something. that what this code is for. // floor control while (_root.lev.hitTest(forecast_x, forecast_y+this._height/2-1, true)) { forecast_y--; xspeed = 0; yspeed = 0; jumping = false; } // ceiling control while (_root.lev.hitTest(forecast_x, forecast_y-this._height/2, true)) { forecast_y++; yspeed = 0; } // left wall control while (_root.lev.hitTest(forecast_x-this._width/2+1, forecast_y, true)) { forecast_x++; xspeed = 0; } // right wall control while (_root.lev.hitTest(forecast_x+this._width/2, forecast_y, true)) { forecast_x--; xspeed = 0; } using the forcast_x and forcast_y values it checks where your going to land, and if it hits ground it continues to moved forcast_x and forcast_y untill they no longer get a negative hit test with the ground. then you just run. this._x = forecast_x; this._y = forecast_y; and that actually moves your character to the final location so you don't see them warping around. and that's it. in effect this causes your character to skate one pixel above the actual ground surface. you just plug in whatever code you need to execute when on the ground, to the ground hit while loop. this code makes solid platforms that bounce you out from all sides, you can make one sided ones with the same code, just make a second ground movie clip, call it something else, and only run the while loops that involve the landing on it check. you also need to check yspeed to make sure your actually falling to and not jumping up through it or you get odd warping. the only other option is to use what you have but increase the frame rate a tun. so you get more code executions at more locations. the only other change you may need to make is if your not using a speed variable, and just applying the movement directly to the player / screen. I know it'll work because I am currently using this method for my own non array based scrolling flash platform game. however, if you continue to insist it's not doable, then ok. eidt oh, duh. since your only moving players sprite along the y, and the stage when you move the x directions you may have to change the code a bit. basically, instead of this._x = forecast_x; try _root._x-=xspeed;
__________________
tfsnewworld.com <-- Updating Mondays, for now. Last edited by Tolka; 10-05-2008 at 05:58 AM. |
|
![]() |
![]() |
![]() |
#26 | |
it's monkey twice!
Join Date: Dec 2007
Posts: 175
|
Re: TF Flash Game
Quote:
Also, that's a raccoon >_> @Tolka (Not gonna quote that whole thing) It's always hard pushing new code into a working project, so help me figure out what's going on with your code as it replaces this: if (_root.ground.hitTest(this._x, this._y, true) && falling) { jump = 13; jumping = false; falling = false; } Falling is a boolean that just turns on when the "jump" hits its peak. Jump is the value used for height. It subtracts a little at a time in the "on keyPress up" section. Jumping is just another boolean that turns on when up is pressed, and it prevents double jumps. if (Key.isDown(Key.UP) && !jumping) { jumping = true; } Self-explanatory. if (jumping) { this.gotoAndStop("jump"); this._y -= jump; jump -= .88; if (jump<0) { falling = true; } if (jump<-15) { jump = -15; } } This is what isn't working when I implement your code into the Ground hit detection. As soon as I press Up, she falls through the floor. Left and right work, but not up. The gotoandStop just goes to the char frame called jump. If I had an actual picture of a jump, it would be a jump. As it is, it's just one of the walk frames. Once again, Jump is 13 and these next two lines dictate how fast it decreases. Jump <0 is checking for the top of the jump so it can start the fall. Jump <-15... to be honest I have no idea what this does. I just know without it, it doesn't work. In case it weren't obvious, my experience in coding isn't with Flash. It's with Java. I'll attach the code. All of this code is on the char movieclip. |
|
![]() |
![]() |
![]() |
#27 |
Process Fan
Join Date: Jun 2007
Posts: 32
|
Re: TF Flash Game
yea, it wouldn't work with that setup. let me take a look at the text file and see if I can get it working.
__________________
tfsnewworld.com <-- Updating Mondays, for now. |
![]() |
![]() |
![]() |
#28 |
Process Fan
Join Date: Jun 2007
Posts: 32
|
Re: TF Flash Game
ok, I'm relay hopeing this works. I tested this in flash 8, and it works about the same as your original code I think. had to rewrite a few parts, besides putting in better fall detection I also took the liberty to fix the walk off ledge jump. however, if you had decided to use that it can be reversed easy enough. you may need to change the hit test + modifiers around a bit depending on how you want the sprite to intersect the ground.
if this works for you, then you will gain the ability to walk up slopes as a bonus.
__________________
tfsnewworld.com <-- Updating Mondays, for now. Last edited by Tolka; 10-05-2008 at 12:26 PM. |
![]() |
![]() |
![]() |
#29 |
it's monkey twice!
Join Date: Dec 2007
Posts: 175
|
Re: TF Flash Game
Needing to do some slight tweaks, but so far it looks like it's working.
Also gonna need to re-do some levels, so give me a while to get a new version out. And I want to test everything with the new code. Thanks for the hard work =) The one thing I notice in your revision that I might not be able to adjust to how it used to be is somewhat realistic gravity. If you jump off of a high ledge, the gravity will increase, but to a set limit and never more than that. So, her fall speed is constant after she hits a max. Not a big deal and changes nothing. The only other thing is that it takes edges much more seriously, so I'm gonna move some jumps closer together. |
![]() |
![]() |
![]() |
#30 |
Process Fan
Join Date: Jun 2007
Posts: 32
|
Re: TF Flash Game
aw man, I knew I'd forget something.
around line 86 there's a while loop with a ground hit test. inside that while loop add ySpeed = 0; and she won't fall full tilt immediately when walking off an edge. I thought something felt off with that. you can change the maximum fall rate with lines 26 - 28 if(ySpeed > 10){ ySpeed = 10; } just raise the 10's for a faster top fall speed.
__________________
tfsnewworld.com <-- Updating Mondays, for now. Last edited by Tolka; 10-05-2008 at 03:44 PM. |
![]() |
![]() |
![]() |
#31 |
it's monkey twice!
Join Date: Dec 2007
Posts: 175
|
Re: TF Flash Game
Coder's rule #1: You will always forget something.
I know how it goes. I've implemented all of the changes and then some. As I wrote before, the new code really has a tendency to notice edges. I found out that it's the left and right edges that it's hitting more often now, so I've loosened all of those up. If the left edge is around 10-20 pixels under the "ground" on a raised platform, she'll think it's a wall and stop walking forward. So I had to either raise the platform or drop the wall. Again, no big deal. I realize I should've kept a changelog, despite not having old versions anymore. 0.0: released. 0.1: Revised 3-3 to be slightly easier 0.2: Revised 1-3 to be slightly easier, placed another reset button near 3-3's finish. 0.3: Fixed hit detection! (Thanks Tolka!) Made 1-3 even easier. Hopefully reduced some of the lag in some stages. Improved "look and feel" of some stages that I felt were lacking. Also added the first cheat! Revised edition is in the first post. So now that everything works (hopefully), I still need ideas on where to go from here. Stages, triggers, post-animations, etc. Last edited by monomonkey; 10-05-2008 at 05:45 PM. |
![]() |
![]() |
![]() |
#32 |
Process Fan
Join Date: Jun 2007
Posts: 32
|
Re: TF Flash Game
played through it again, found one last bug from that edit I had you do, that makes jumping up through platforms sort of... interesting.
where I had you add ySpeed = 0; change it to if (!jumping){ ySpeed = 0; } that just prevents it from stooping your jump momentum when you pass through a platform. hopefully that's the last tweak. ![]() anyway, you have quite the assortment of locations listed, but the only transformation idea that pops to mind is a penguin in the arctic even if not technically the right Reagen. maybe from fish, or eggs. uh reindeer, polar bear, walrus? you already did a fox and rabbit so maybe not arctic hare or arctic fox unless you want extras
__________________
tfsnewworld.com <-- Updating Mondays, for now. |
![]() |
![]() |
![]() |
#33 |
Process Disciple
Join Date: May 2005
Location: Illinois
Posts: 1,505
|
Re: TF Flash Game
I know it's not going to happen, but I'd still like to see some TFs that don't result in a game over.
|
![]() |
![]() |
![]() |
#34 |
Process Fan
Join Date: Jan 2006
Posts: 42
|
Re: TF Flash Game
Nice game...Can't wait to see more.. ^_^
By the way, in the first area of The Woods, if you jump to the right from standing on the "to forest" sign, you land on a invisible platform it seems...You can pretty much bypass the whole first area that way by walking on it to the end. Not sure if it was meant to be there...If not, then I found a little bug... >_> |
![]() |
![]() |
![]() |
#35 | |||
it's monkey twice!
Join Date: Dec 2007
Posts: 175
|
Re: TF Flash Game
Quote:
Also, the list of animals I have is in the first post. I have already done the penguin sprite. Since I haven't done any other Arctic animals yet, though, I haven't bothered to make the Arctic stage. By the way, when I do, I'm gonna need sliding. I'm sure I can figure it out myself. Just lower the value of "slowdown" that decreases X after you let go of the arrow key, I bet. The underwater level is supposed to be underwater, so I'm going to lower the speed of descent and turn the sprites sideways for "swimming" Quote:
I have a lot of ideas pop into my head while brainstorming for stages (other than stages, unfortunately). One of which is regarding stages where two or more items (milk, tennis balls, etc) need to be hit to trigger it. I figure I could try to do the simple ones from the side, like ears/tail when those get hit. The initial plan for this project was to hit a trigger, do a cutscene-esque thing, and then have the sprite for movement change to the finished product, but the level wouldn't end. I haven't scrapped this idea, but it does mean editing a whole new series of sprites from the side, which might be hard for me not being a graphic designer. In the end I might just make a new game entirely for this concept, or at least a new setting in the menu for it. Now that I think about it, since I'm doing idle animations for everything anyway, I could just copy those into the new sprite and get new use out of them. Tell you what. If I don't get stage ideas from anyone, I won't have anything else to work on, so I'll try working on that. Quote:
I was getting tired of jumping over the carrots every time I wanted to get to the 2nd part to test new code I wrote so I made that invisible platform. You can bypass the entire thing unless you jump. Since it's invisible, you cannot land on it more than once. Somehow. What has Science done? (Though I have a trick for bypassing the "unlock" menu for myself =x) ---- Anyway, I'm sure anyone could've found this on their own, but here it is. This is the sprite sheet I used for the game. http://sdb.drshnaps.com/SpritesPC.htm#Azumanga I believe I used the second image in the top row for everything. I used two images in the second row for Idle, and obviously row 3 column 2 for Walking. Oh, and if I can find a way to save your data so you don't have to re-play all of the stages again to go to any one you want, I'll work that in too. Once again, feel free to submit anything you want in the game. I am more left-brained, so it's hard for me to be creative. I'm always looking for: Animal ideas (suited for the locations, or even provide a new location entirely). Don't feel limited to real-world animals either. I have no problem doing mythical animals (already done two as mentioned in the original post) or video game animals (already done 10 as mentioned in the original post.) TF Triggers (the cause, typically relevant to the animal or location. I don't like it based on "magic". I feel like it should be rooted in something that "could" happen in a world where TFs are possible.) Processes (Somewhat limited by Flash, as you can already tell from the game. If there's a specific way you want it to happen, I'll see what I can do.) Post-animation (What she does afterwards. Again, relevant to the animal if possible. Difficult for animals that are average, so most of the time I stick to tail movement one way or the other) Stages! (The obstacles, the goal, the traps, etc. Thanks to the revised code from Tolka, much more imaginitive stages are possible. I couldn't use slopes before, but now I can. The hit detection will even wrap to curved surfaces.) ...Anyone else notice I tend to write too much? |
|||
![]() |
![]() |
![]() |
#36 |
ENEMY AC-130 ABOVE!
Join Date: Sep 2007
Location: California
Posts: 87
|
Re: TF Flash Game
i cant play it, everytime i open it i just get the code ..im no computer genius ...so im kinda lost XD
|
![]() |
![]() |
![]() |
Thread Tools | |
Display Modes | |
|
|