if anyone wants the FLA's i'll upload them, it would be nice it folks could come up with an answer, and i maybe have have another go next year
sorry my heads in the wrong place, I setting ridiculous task to try and take my mind off something
JohnGreenArt- 12-15-2007
I'd be interested in tinkering around with it, but the last thing I need is another game engine to distract me.
NigeC- 12-15-2007
I uploaded the tutorial resources rather than my "buggered about with" ones,
you can download them here, the tutorial said your free to modify and change in whatever way
you run the editor in Flash, use "-*test*-('") movie" so it will produce the XML in the output window, copy and paste in a text editor and save as level1.xml (backup the original)
Just remember you need to change images in both the the editor and the player
Enjoy!
BTW
its from
Macromedia Flash MX Game Design Demystified. The Official Guide to Creating Games with Flash - Jobe Makar which is really helpful
NigeC- 12-20-2007
ok I've gone back to basics and I'm doing it from scratch, working from version 2 of the platformer demo from the Lassie site
i have about grasped it all, and could actually build a level from it, but for some reason i can't get walk animation
I've highlighted in read what i think is wrong, i can get "still" animation
Ive tried in the timeline and it currently a movie clip, does it need defining as such?
The right hand view does show but doesn't walk
if (Key.isDown(Key.RIGHT)) {
dir = "right";
h._x += xSpeed;
[color=red]h.gotoAndPlay("walkr");[/color]
// cannot be spiderman and cling to sides.
if (jumping == true) {
if (ps.hitTest(h._x+x+hb.xmax, h._y+y+(hb.ymin), true) || ps.hitTest(h._x+x+hb.xmax, h._y+y-10, true) || ps.hitTest(h._x+x+hb.xmax, h._y+y-20, true) || ps.hitTest(h._x+x+hb.xmax, h._y+y-30, true) || ps.hitTest(h._x+x+hb.xmax, h._y+y+(hb.ymax-buffer), true)) {
h._x -= xSpeed;
}
}
}
}
bigmac- 12-20-2007
Nige, I can't tell much from this code snippit given that it doesn't have context as to what is what. However, I would assume your hero is the "h" movieclip? What are you using "gotoAndPlay" on the timeline? That begs difficulty. Keep your character structured like a Lassie character where you have a timeline with a frame for each walk state, then an animation on each frame of the character actually doing... whatever. Then you'll permanently keep the hero timeline stopped and just be playing whatever animation in on the frame.
Hope that helps.
NigeC- 12-20-2007
It used GotoandPlay (actually it was GotoandStop) i messed up there sorry
I does have a 3 layer "hero" ie actions, labels and animation
it has still, duck and walkr
thats the AS
I need something around the
// Hero Movement
heroMovement();
right?
Sorry my PC has fecked up big time i was intending to do 3D stuff for Noth but my video card can't handlle DirectX programs as the video card has gone screwy!
stageWidth = 450;
score = 0;
// Hero Variables
dir = "still";
xSpeed = 3;
maxVelY = 11;
buffer = 25;
jumpingAmount = -11;
velY = jumpingAmount;
jumping = false;
h = _root.hero;
hb = h.getBounds();
// hero movement
function heroMovement() {
if (Key.isDown(Key.LEFT)) {
dir = "left";
h._x -= xSpeed;
// cannot be spiderman and cling to sides.
if (jumping == true) {
if (ps.hitTest(h._x+x+hb.xmin, h._y+y+(hb.ymin), true) || ps.hitTest(h._x+x+hb.xmin, h._y+y-10, true) || ps.hitTest(h._x+x+hb.xmin, h._y+y-20, true) || ps.hitTest(h._x+x+hb.xmin, h._y+y-30, true) || ps.hitTest(h._x+x+hb.xmin, h._y+y+(hb.ymax-buffer), true)) {
h._x += xSpeed;
}
}
}
if (Key.isDown(Key.RIGHT)) {
dir = "right";
h._x += xSpeed;
// cannot be spiderman and cling to sides.
if (jumping == true) {
if (ps.hitTest(h._x+x+hb.xmax, h._y+y+(hb.ymin), true) || ps.hitTest(h._x+x+hb.xmax, h._y+y-10, true) || ps.hitTest(h._x+x+hb.xmax, h._y+y-20, true) || ps.hitTest(h._x+x+hb.xmax, h._y+y-30, true) || ps.hitTest(h._x+x+hb.xmax, h._y+y+(hb.ymax-buffer), true)) {
h._x -= xSpeed;
}
}
}
}
// hero hitTest
function sideTopHitTest() {
for (i=0; i<1; i++) {
// Hero Side hitTests
// Left
if (ps.hitTest(h._x+x+hb.xmin, h._y+y+(hb.ymin), true) || ps.hitTest(h._x+x+hb.xmin, h._y+y-10, true) || ps.hitTest(h._x+x+hb.xmin, h._y+y-20, true) || ps.hitTest(h._x+x+hb.xmin, h._y+y-30, true) || ps.hitTest(h._x+x+hb.xmin, h._y+y+(hb.ymax-buffer), true)) {
h._x += xSpeed;
}
// Right
if (ps.hitTest(h._x+x+hb.xmax, h._y+y+(hb.ymin), true) || ps.hitTest(h._x+x+hb.xmax, h._y+y-10, true) || ps.hitTest(h._x+x+hb.xmax, h._y+y-20, true) || ps.hitTest(h._x+x+hb.xmax, h._y+y-30, true) || ps.hitTest(h._x+x+hb.xmax, h._y+y+(hb.ymax-buffer), true)) {
h._x -= xSpeed;
}
// Hero Top hitTest
if (ps.hitTest(h._x+x+(hb.xmin+1), h._y+y+(hb.ymin-2), true) || ps.hitTest(h._x+x+(hb.xmax-1), h._y+y+(hb.ymin-2), true)) {
velY = 4;
xSpeed = -.2;
}
// Boundaries
if (h._x-(h._width/2) <= 0) {
h._x = h._width/2;
} else if (h._x+(h._width/2) >= 450) {
h._x = 450-(h._width/2);
}
}
}
function jump() {
for (i=0; i<1; i++) {
if (ps.hitTest(h._x+x+hb.xmin, h._y+1.5, true) || ps.hitTest(h._x, h._y+1.5, true) || ps.hitTest(h._x+x+hb.xmax, h._y+1.5, true)) {
velY = 0;
jumping = false;
} else {
jumping = true;
}
if (Key.isDown(Key.UP) && jumping == false) {
velY = jumpingAmount;
jumping = true;
}
if (jumping == true) {
h._y += velY++;
}
if (velY > maxVelY) {
velY = maxVelY;
}
}
}
// Platform Variables
ySpeed = 1;
psvMin = 80;
psvMax = 160;
psv1Min = 134;
psv1Max = 200;
st = _root.tile;
p = _root.platform;
ps = _root.platform.solid;
psv = _root.platform.solid.vPlatform;
psv1 = _root.platform.solid.vPlatform1;
// platform visible or not
ps._visible = false;
// -------------------------------------------------- Enterframe
// -------------------------------------------------- Enterframe
// -------------------------------------------------- Enterframe
// -------------------------------------------------- Enterframe
this.onEnterFrame = function() {
// ------------------------------------------------------- Hero
h.gotoAndStop("still");
// 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++;
}
// Ducking
if (Key.isDown(Key.DOWN) && jumping == false) {
dir = "duck";
h.gotoAndStop("duck");
jumping = false;
xSpeed = 0;
} else {
if (Key.isDown(Key.SPACE)) {
xSpeed = 4.5;
} else {
xSpeed = 3;
}
}
// Hero Movement
heroMovement();
// Hero Jump
jump();
// Hero hitTest
sideTopHitTest();
// ---------------------------------------------------- Score
for (i=0; i<2; i++) {
if (h.hitTest(p["gold"+i])) {
score += 10;
p["gold"+i].gotoAndStop(2);
}
}
//
// Platform
//
// Scrolling
if (h._x >= 301) {
if (p._x >= -(p._width-stageWidth-1)) {
h._x = 300;
p._x -= xSpeed;
st._x -= xSpeed;
if (st._x <= -(st._width-stageWidth)) {
st._x = 0;
st.t1.nextFrame();
st.t2.nextFrame();
if (p._x <= -(p._width-stageWidth-1)) {
st._x = -(st._width-stageWidth);
p._x = -(p._width-stageWidth);
}
}
}
}
if (h._x <= 149) {
if (p._x < 0) {
h._x = 150;
p._x += xSpeed;
st._x += xSpeed;
if (st._x >= 0) {
st._x = -(st._width-stageWidth);
st.t1.prevFrame();
st.t2.prevFrame();
if (p._x >= -1) {
st._x = 0;
p._x = 0;
}
}
}
}
};
bigmac- 12-21-2007
...erm, posting full source isn't what I meant when I said I couldn't put the code in context. In general, lets take a step back from code. Code is udder rubbish. Everyone puts so much stock in code when the heart of the issue is logic. Logic runs an application, code is just the vehicle that expresses it; and most fledgling programmers get hung up on not understanding "the code" when the real problem is that they don't understand what the code is doing and what it needs to do.
So, in psudo-code (logical train of through), tell me what the program is doing, and what it's not doing that you want it to do. Then we'll talk about what logic needs to be added to accomplish that, and I'll leave it to you to interpret that logic into code.
NigeC- 12-21-2007
As i see it:
hero = h
when he's still.. the code goes to the "still" frame in the hero clip i can animate that frame
the code uses to do this
h.gotoAndStop("still");
I'm trying to have left and right walk animation, so i tried a similar code on if (Key.isDown(Key.RIGHT)) {
dir = "right";
I can get it to go to a walk frame by adding h.gotoAndStop("walkr") but
its not animated
Is the
h.gotoAndStop("still"); preventing the animation in the walk cycle?
Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.