View Full Version: Flash Dizzy Engine

lassie >>In production >>Flash Dizzy Engine


<< Prev | Next >>

NigeC- 12-09-2007
Flash Dizzy Engine
Just lately I've been hitting the books to get a better understanding of Flash, in one of the tutorials i found a fantastic template to create platform games, so after quite a few sleepless nights the Dizzy Editor was born the arrows move the game screen area, theres a gap tool, the 3 icons are for collectibles, tiles and enemies, on the icons you have an info button, using this you choose which tile you wish to use and define whether its solid, container etc, the editor creates a XML level code <level flagx="1644.65" flagy="333"> − <blocks> <block x="-20" y="55" type="solid" graphic="plate1" container="false"/> <block x="245" y="-65" type="solid" graphic="cube" container="false"/> <block x="245" y="-65" type="solid" graphic="cube" container="false"/> <block x="235" y="-65" type="solid" graphic="ice platform" container="false"/> <block x="310" y="55" type="solid" graphic="plate1" container="false"/> <block x="200" y="55" type="solid" graphic="plate1" container="false"/> <block x="420" y="55" type="solid" graphic="plate1" container="false"/> <block x="90" y="55" type="solid" graphic="plate1" container="false"/> <block x="760" y="205" type="solid" graphic="plate1" container="false"/> <block x="565" y="130" type="solid" graphic="plate1" container="false"/> <block x="960" y="250" type="solid" graphic="plate1" container="false"/> <block x="1275" y="25" type="solid" graphic="tree" container="false"/> </blocks> − <grounds> <ground xstart="0" xend="4800"/> </grounds> <baddies/> <collectables/> </level> short demo http://nigecstudios.co.uk/games/dizzy/dizzy.html Don't be under any illusions i know what I'm doing! but I am learnin a lot by dismantling and replacing stuff as i go along I need to find away to create a inventory also at the moment the character can only walk on flat surfaces The main focus is to get the complete tile set in place and build a full level, hopefully by then I've figured out the problems or someone jumps in to offer a help in hand (hint, hint) BTW this is running along side NOTH, and I'll swap between the two, its good to have a distraction!

fatbuoy1- 12-09-2007

Kewl! Is this Lassie based or did u build it up from scratch?

bigmac- 12-09-2007

No, this definitely isn't Lassie-based. Nice work Nige... so if you have no idea how it works, then how did you build it? Was this entirely tutorial stuff? And I assume the "hint, hint", was directed at me? Help is always available for those who ask for it, though I have enough of my own projects that my help will not involve building it for you. So long as you're doing the real work, I'm always available as a brain to pick at.

NigeC- 12-09-2007

Its built from the tutorials, theres quite a bit that went over my head, but the more i mess with it, the more i understand how things work, some resources where pre made, for me personally its a great way to learn It would be great if you could help Greg, but obviously I'll leave you alone until you have the time, i know your incredibly busy with life, the universe and everything! If i can get the content added and be able to create decent levels I'll be quite happy I sorted the "Dizzy walking on thin air issue"

bigmac- 12-09-2007

Hey Nige, No worries about my schedule... you're welcome to post questions as they arise and I'll answer them when I get a chance. But again, that's all I'm offering: answers to questions. Please don't anticipate any support in any of the actual technical development.

NigeC- 12-10-2007

the burning issue is how to get him to walk up an incline or step up, its about the only thing not covered! if you want to have a browse over the action script i'll email it on to you

SeanCyrusTowel- 12-10-2007

Hey nice job Nige. Once you figure all the ins and outs out (sounds redundant) I have a challenge for you. Presently the background moves when the character moves. This looks a little odd on the ground floor when you jump, but great everywhere else. Try to come up with a condition so it'll only move when the foreground is moving. I don't think that would be too hard to figure out. I'm guessing you don't know where the background is from. It looks a lot like The Forrest of Illusion levels in Super Mario World from the SNES.

bigmac- 12-10-2007

Nope, I don't want to look over the code. I have plenty of my own to look through. :) But concerning your scenario, go into the Lassie site downloads section and grab the last file in the list: Flash minigame ideas. There's a bundle of open source FLAs from various sources in there; the one you'll find of interest is called "platformer". You'll see this type on logic in action. The logic that powers this within that FLA's code are the first few lines in the onEnterFrame handler: // Move hero back up while (ps.hitTest(h._x+hb.xmin, h._y-2, true) || ps.hitTest(h._x+hb.xmax, h._y-2, true)) { h._y--; } // Slope down if (ps.hitTest(h._x+x+hb.xmin, h._y+buffer, true) && ps.hitTest(h._x+x+hb.xmax, h._y+buffer, true)) { h._y++; } What's cool is that that's a live "gravity" increment, so that if you walk off a ledge the character will start falling until they hit ground again.

NigeC- 12-10-2007

Thanks Greg I'll take a look @Seancyrustowel I've fixed that, the background was to big

bigmac- 12-10-2007

Hey, I'm looking again over the code snippit that I posted earlier today... for better reference on the logic, I'll write that out in psudo-code... Do this once a frame (onEnterFrame): - Run a "while" loop. This operation runs for as many times necessary until the condition is fulfilled... > While either the bottom-left or bottom-right corner of the character is touching the ground (determined by a hitTest), then move the character up. (ie: walk up slope) - If the bottom-left or bottom-right edge of the character are not touching the ground, move the character down 1 pixel (if this occures over many frames, then the character will appear to be falling). Make sense?

NigeC- 12-10-2007

That makes a lot more sense figuring out how to translate it into my project is a different matter lol All the action script is in functions le: hero.walkRight = function() { this.isWalking = true; this.clip.animation._xscale = 100; if (!this.inAir) { this.clip.animation.play(); } }; hero.walkLeft = function() { this.isWalking = true; this.clip.animation._xscale = -100; if (!this.inAir) { this.clip.animation.play(); } }; there is also gravity and wind resistance maybe i've bitten of more than i can chew here

bigmac- 12-10-2007

All the action script is in functions Well I should hope so! Looking at those tow functions, those have nothing to do with the actual character motion. Those are just controlling animation properties. Incidentally, I noticed that the character's registration point isn't centered. as I was playing it. That's why the character jumps position as you flip it's facing direction back and forth. Center the registration and that won't be noticeable. But going back to the issue at hand, you'll want to find where the character's "_x" property is being adjusted. That's what's setting it's horizontal position. What you need to adjust is it's "_y" property. That will adjust it's vertical position on screen. Again, look for the game's onEnterFrame handler. I'd think it's in there somewhere. Then inset that code snippit I posted and adjust the params. I wouldn't worry about hitTesting it's bottom left and right positions. Just put it's registration point at the bottom center and hitTest against that. It frees up processor cycles and will work better for the bizarre shaped character. As for start-points on coding... the best way to learn is by writing your own code rather than deciphering someone else's. Working in other people's code is difficult even for experienced developers; and to a noobe who is unfamiliar with the language it will be meaningless. Writing your own code will force you to understand WHY things work the way they do. Instead of taking it for granted that code ABC makes Flash do XYZ, you start learning the actual logical processes that makes this magic happen.

NigeC- 12-10-2007

I totally agree i should really start from scratch.. i can, sort of see how and why things work.. expanding on it is a different matter Thanks Greg.. I'll put this to one side and try to do it in smaller steps

NigeC- 12-12-2007

I'm going to abandon this, , with it using a drag and drop editor i can't figure out how to to control platforms and ground feel free to delete the thread, its not Lassie related anyway

bigmac- 12-12-2007

Eh, I'll keep it up. It could be a point of interest for other developers.

Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.