Log In  

Cart #27372 | 2016-08-26 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

Got things mostly working. (but still borked on right walls and cornes) Placeholder camera implemented, want to add dead zone and false boundaries to it eventually.

Taking an official break of sorts while I contemplate robust collision (and probably slopes) offline. I've made some progress on the theme/flavor, but I'm still keeping that to myself while I hammer on the basics.

Strange, editing the post I got the bbs to eat all my previous version. Broken tags below.


0.15 - Here it's half-working with all sorts of fun debug displays added.
by
Cart #27096 | 2016-08-20 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

0.14 - First pass at something resembling collision; completely broken for the moment. But don't offer assistance yet! When I get back home I'll have time to dig in it and see what has transpired.

by
Cart #27062 | 2016-08-18 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

ver 0.13 - I needed a little air control, too

by
Cart #26786 | 2016-08-12 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

ver 0.12 - Here, have a jump

by
Cart #26783 | 2016-08-12 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

ver 0.1 - just trying to lay out some of the basics - no collision, vertical movement, or really anything so far.

by
Cart #26752 | 2016-08-11 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1


P#26753 2016-08-10 23:08 ( Edited 2016-08-26 03:10)

debugging:
(0.16)
Never ever assume. Even when not in doubt, print out the number and double check it. Also be sure to re-read the quirks section of the manual at least once per project.

Most recently I was reminded that sgn() returns 1 for a value of zero.

And flr() returns the lowest whole number, not the integer part of the number. (i.e. flr(-1.1) returns -2)

past versions:

still faking it:
(0.15)


Ok, here's the player update take two. (collision up next)

--state

p={
    x=32, 
    y=32,
    xa=2, --accel.
    ya=-6,
    dx=0, 
    dy=0,   
    mx=5, --top speed
    xf=1.5, --ground friction, air control
    my=9, --terminal velocity
    j=0, --jump timer: 0=freefall, -1=grounded
    jt=25, --how long a jump lasts
}

--update delta

if (p.j<0) then --grounded?
    if (btn(O)) then --jump button?
        p.j=p.jt --start new jump
        p.dy=p.ya
        p.dx=btn(0)*(-p.mx)+btn(1)*p.mx --jump speed boost
    else --on ground, not jumping
        p.dx-=abs(p.dx)*sgn(p.dx)*p.xf --friction
        if (btn(0))p.dx=max(p.dx-p.xa,-(p.mx))
        if (btn(1))p.dx=min(p.dx+p.xa,p.mx)     
    end --newjump/grounded
else --in air
    p.j=max(0,p.j-1)
    if (btn(1)) p.dx=min(p.dx+p.xf,p.xf)--air control
    if (btn(0)) p.dx=max(p.dx-p.xf,-(p.xf))
    if (p.j==0)p.dy=min(p.dy+p.my,p.my)--gravity
end --ground/air

--resolve collision

if p.dy<0 then
    --headcheck
end
if p.dy>0 then
    --groundcheck
end

--update state
p.x+=p.dx
p.y+=p.dy

failed update:
(0.14)


I took some shortcuts getting the jump in before adding collision, and it all got confusing in my head, so here's a map of move/jump-related logic while I sort it back out:

on ground?
    jump button?
        new jump
            vert/horz boost
            start jump timer
        walking
            horz input
            friction
            movement
            fall check
(in air)
    air control here(?)
    mid-jump?
        jump button?
            jump timer decrement
        (user-stopped jump)
            clear jump timer
    (jump is over)
        double jump?
            vert/horz boost
            reset jump timer
(in air, moving now)
    add gravity, move vert
    moved up?
        headcheck?
            bang, flr(+0.5) vert pos, zero vel
    (moved down)
        thud?
            set walk flag, flr() vert pos, zero vel
move horz (cap speed)
rightward?
    check for walls?
        flr() horz pos, zero vel
(leftward)
    check other walls?
        flr(+0.5) horz pos, zero vel

Note that there are some corner-cases I might need to deal with since the vertical and horz happen separately. Also I will be totally redoing this, after noticing that I duplicate horz collision. (among other things)

philosophy:
(0.13)(0.12)


aug 11 - When I played through am2r, one of the first things I noticed was starting with a pile of rockets. (then not needing 5 for red doors, and being able to run around shooting them like candy)

Maybe I'm just getting old, (speaking of I need to edge my lawn,) but I'm pretty much done with attacking everything. Shoot is one of the least interesting verbs. I was thinking maybe I should finally upgrade and try out overwatch, but ultimately I couldn't pull the trigger. [stupid joke dog] So I'm leaving out weapons as long as I can. Maybe I'll include a little stomping or dashing through, but we'll see.

origins:
(0.1)

Aw, crud. I just copy/pasted away my whole yarn about what got this started.

Let's just say I replayed Super Metroid recently, and then played through AM2R (blind) and had some meh feelings about it. Since talk is cheap, I'm making this. (what better place to risk failure than this relatively small corner of the internet?)

The gist - at least a few upgrades that are primarily movement-related and have potential for synergy. Level elements that should work in multiple layers for both traversal and soft/hard gating. Trying to avoid space-archeology, not married to any particular time/paradigm yet.

edit: My first thoughts after posting 0.1 and a bit of reflection is I might need to go to 2x3 for the player size.

I also fear what I might wind up doing if I get into the slopes and things that I sort of crave. (one of the things I might crib from am2r to keep it simple)

P#26754 2016-08-10 23:15 ( Edited 2016-08-26 03:02)
P#26787 2016-08-12 05:01 ( Edited 2016-08-12 09:02)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 11:24:43 | 0.020s | Q:31