Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 37

Thread: Lua Coding

                  
   
  1. #21

    Default

    ok what do i do after this

  2. #22
    DCEmu Coder splodger15's Avatar
    Join Date
    Jun 2006
    Location
    London
    Age
    34
    Posts
    4,123
    Rep Power
    95

    Default

    We will add some controls now enter this
    -----------------------------------------------------------------
    This moves the car up and down
    -----------------------------------------------------------------

    if pad:up() then
    character = car1
    player.y = player.y - 2
    end

    if pad:down() then
    character = car1
    player.y = player.y + 2
    end

    -----------------------------------------------------------------
    This moves the car left and right
    -----------------------------------------------------------------
    if pad:left() then
    character = car1
    player.x = player.x - 2
    end

    if pad:right() then
    character = car1
    player.x = player.x + 2
    end

    ------------------------------------------------------------------
    Enter that in to your code

    PSN ID: splodger15

  3. #23

    Default

    ok its in my code now...what next

  4. #24
    DCEmu Coder splodger15's Avatar
    Join Date
    Jun 2006
    Location
    London
    Age
    34
    Posts
    4,123
    Rep Power
    95

    Default

    Now save as script.lua

    And run it

    PSN ID: splodger15

  5. #25

    Default

    it says error: script.lua:7: Image.load: Error loading image.

  6. #26
    DCEmu Coder splodger15's Avatar
    Join Date
    Jun 2006
    Location
    London
    Age
    34
    Posts
    4,123
    Rep Power
    95

    Default

    aahhhhh you have your first error do you have both of the images i posted here

    This is the error here

    ---------------------------------------------------------------------------------------------------

    Room_width = 480
    Room_height = 272
    player1x = 15
    player1y = 136
    road=Image.load("images/weapon.PNG")
    background=weapon
    car1=Image.load("images/car1.PNG")
    player1=car1


    What you need to do is remove the word images on both of them just remove the word images nothing else

    PSN ID: splodger15

  7. #27

    Default

    yea i noticed that but it still says i have an error on line seven. this is what i have in my script

    Room_width = 480
    Room_height = 272
    player1x = 15
    player1y = 136
    weapon=Image.load("weapon.PNG")
    background=weapon
    car1=Image.load("car1.PNG")
    player1=car1

  8. #28
    DCEmu Coder splodger15's Avatar
    Join Date
    Jun 2006
    Location
    London
    Age
    34
    Posts
    4,123
    Rep Power
    95

    Default

    do you have both of the images i posted on this site
    save them as PNG

    Save the background as weapon.PNG

    and the car as car1.PNG

    PSN ID: splodger15

  9. #29

    Default

    ok i got that to work...now when i run it it tells me
    errors: script.lua:12: attempt to index global 'pad' (a nil value)

    for me line 12 is
    player.y = player.y - 2

  10. #30
    DCEmu Coder splodger15's Avatar
    Join Date
    Jun 2006
    Location
    London
    Age
    34
    Posts
    4,123
    Rep Power
    95

    Default

    Post your whole script here

    PSN ID: splodger15

Page 3 of 4 FirstFirst 1234 LastLast

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
  •