
-----------------------------------
Aange10
Wed Oct 12, 2011 3:26 pm

Platformer (Climber)
-----------------------------------
Not sure whether to post this Alpha in the help forum or here. So I put it here.

I'm making a game with a friend just to put everything I've learned together, and make something I'm proud of. I'm posting this here to ask a few questions, and get some key feedback:
1. Do you see any flaws?
2. Is the coding messy/repetitive/inefficient? 
3. Is the game's collision too messy?
4. Is 3. easily noticeable?
5. Do you have any suggestions to add (no flaming/sarcasm please)?
6. Any links you think would benefit me?
7. Did you like this first level? (It's an intro "level")

NOTE: This is not the full game, nor is it close to the final product. This is just testing the collision/graphics engine of the game, and the omniscient narrations.


If you'd like your name on the credits list, comment below!

-----------------------------------
Zren
Wed Oct 12, 2011 11:04 pm

RE:Platformer (Climber)
-----------------------------------
Okay, that should get you started, but I doubt that's everything.

~

If you get the "not nuff mem to indent file" because you've got lines longer than x chars, you can do:


if true
        and true
        and true
        then
    put "whoa"
end if


~

Your types need work. Typically you do player.x or platform.w instead of platform.plat_width. I remember reading this in another thread I think. If you want to change it in this code, backup the file then use Search > Replace .var -> .newvar and click replace all.

~


plat_height (1) := 50
plat (1).plat_y := (ground_y + ground_height) + plat_height (1)


Why'd you make a whole extra array (plat_height)?

Also, hardcoding values will be a pain no matter what. Consider loading platforms from a text file (x,y,w,h). Check out the example given for 
proc debug_show
    loop
        if show_debug = false then
            show_debug := true
            exit
        end if
        if show_debug = true then
            show_debug := false
            exit
        end if
    end loop
end debug_show


That has to be the worst implementation of toggling a boolean I've ever seen. Why in gods name is there a loop?

~

I'd move the collision detection to a function that returns a boolean personally. That way I could just use something like:

fcn collision(a, b:Rect) :boolean
result a.x + a.w .....

~

I'd also move the common variables from both of your types to a subtype. Both platform and player types are rectangles, so I'd give it it's own rect type, then have each of the super-types have it's own r:Rect instead of their own w,h,x,y variable.

~

Example pulled from old code.

type Point :
    record
        x, y : real
    end record
type Rect :
    record
        x, y, w, h : real
        a, b, c, d : Point
    end record

fcn point (x, y : real) : Point
    var p : Point
    p.x := x
    p.y := y
    result p
end point

fcn rect (x, y, w, h : real) : Rect
    var r : Rect
    r.x := x
    r.y := y
    r.w := w
    r.h := h
    r.a := point (r.x, r.y)
    r.b := point (r.x + r.w, r.y)
    r.c := point (r.x, r.y + r.h)
    r.d := point (r.x + r.w, r.y + r.h)
    result r
end rect

fcn pointInRect (p : Point, r : Rect) : boolean
    result r.a.x 