Log In  
Follow
lewsidboi
Follow

Cart #moonmissions-9 | 2020-11-06 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
8

Moon Missions

My take on a lunar lander game, for the Pico-8.

Features:

  • One obnoxious flying saucer
  • A catchy intro tune
  • Semi-procedural levels
  • Persistent high scores

Directions:

Try to land your lunar vehicle on the surface of the moon while keeping an eye on your fuel
and landing speed. Do your part to advance science (and boost your high score) by passing
through each level's "data" waypoints. Keep an eye out for alien interface!

Tip 1: When your landing speed is too high to land, warning lights flash from within your ship.
Tip 2: Keep your eyes out for each level's fuel cannister to get some extra range and boost your score.

Playable in browser at https://www.lexaloffle.com/bbs/?tid=40106

Controls:

  • Up/Left/Right to control directional thrusters
  • (❎) can also be used as an alternate for up thrust

Credits:

This game was designed and created by me, lewsidboi, for you.

http://lewsid.com

P#83563 2020-11-01 03:55 ( Edited 2020-11-06 03:45)

How would I go about comparing numbers greater than 32,767?

I'm using @Felice's code from https://www.lexaloffle.com/bbs/?pid=22677:

function get_score_text(val)
    local s = ""
    local v = abs(val)
    while (v!=0) do
        s = shl(v % 0x0.000a, 16)..s
        v /= 10
    end
    if (val<0)  s = "-"..s

    if(s=="") then
        s="0"
    end

    return s 
end 

I'm saving the three highest scores to the cart data. Unfortunately, I'm struggling to solve how to determine if the user's current high score (stored as a string) is greater than one of the other three. I'm looking for a function along these lines:

function check_new_high_score()
    --high_scores = table of tables { 1 => (player_name), 2 => (player score) }
    for i=1,#high_scores do
        local raw_high_score = get_score_text(config.total_score)
        local raw_saved_score = high_scores[i][2]

        if(raw_high_score>raw_saved_score) then
           return i
        end
    end

    return false
end

Unfortunately, yea, this just fails because I'm comparing strings to each other with a comparison operator. I'd love to know how to resolve this, I've been struggling with it for some time. Things end up in weird places:

P#82692 2020-10-07 22:48 ( Edited 2020-10-07 22:51)

Follow Lexaloffle:        
Generated 2020-11-28 07:56 | 0.121s | 4194k | Q:30