Results 1 to 2 of 2

Thread: Need help with Lua Collision and high score

                  
   
  1. #1
    DCEmu Rookie fatcat04912's Avatar
    Join Date
    Sep 2006
    Posts
    151
    Rep Power
    67

    Default Need help with Lua Collision and high score

    Hello im Making a A simple game Were you bounce a ball .. i have the bounce part set i think. but i Want to Have stars randomly appear And you jump your ball to collect them, And when you Collect then the star dissapers and you you score increases. But i cant figure out how Note this is my first Coding ever....

    Here is my Code.... Its basically the How to jump code From this site but with alterations :

    -- Load colors

    black = Color.new(0,0,0)
    green=Color.new(0,255,0)
    white = Color.new(255,255,255)
    blue= Color.new(37,6,237)

    -- load images

    player1 =Image.load("Img/earth.png")
    ground =Image.load("Img/background.png")
    bg =Image.load("Img/bg.png")

    -- load player

    ground =Image.load("Img/base.png") player = {}
    player.gravity = 230
    player.y = 230
    player.x = 50
    player.jumpspeed = 5
    player.jumpstate = "ground"
    while true do
    pad = Controls.read()
    screen:clear()
    -- load background
    screen:blit(0, 0, bg, false)

    -- control speed

    if pad:left() then
    player.x = player.x - 2
    end
    if pad:right() then
    player.x = player.x + 2
    end

    -- Gravity
    if pad:cross() and player.jumpstate == "ground" then
    player.jumpstate = "jumping"
    end
    if player.jumpstate == "jumping" then
    player.jumpspeed = player.jumpspeed -0.0
    player.gravity = player.gravity - player.jumpspeed
    end
    if player.gravity < 0 then
    player.jumpstate = "falling"
    end
    if player.gravity < 230 and player.jumpstate == "falling" then
    player.gravity = player.gravity + (player.jumpspeed + -0.3)
    end
    if player.gravity == 230 then
    player.jumpspeed =3
    player.jumpstate = "ground"
    end
    if player.gravity > 230 then
    player.gravity = 230
    end
    player.y = player.gravity
    screen:blit(player.x,player.y,player1)
    screen:blit(0,262,ground)
    -- Upper text
    screenrint(20,15, "Welcome to Moon Mode =)",white)
    if pad:start() then
    dofile("options.lua")
    end
    -- Screen Shot
    if pad:select() then screen:save("screenshot.png")
    end
    screen.waitVblankStart()
    screen.flip()
    end


    I Made this using LuaDevKit R2

    YOU DON"T NEED LUA PLAYER

    Here are some ScreenShots:




    Download--->
    Spoiler!

  2. #2
    DCEmu Pro dangee's Avatar
    Join Date
    Feb 2007
    Posts
    531
    Rep Power
    65

    Default

    strongly recommend some time spent over at evilmana

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •