Seite 14 von 342 ErsteErste ... 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 64 114 ... LetzteLetzte
Zeige Ergebnis 391 bis 420 von 10238

Lua Programming Help Thread

This is a discussion on Lua Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; have u tried this on a PSP yet because it doesnt work on the Lua Player for Windows...

  
  1. #391
    QJ Gamer Green
    Points: 40.380, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Ort
    Grand Line
    Beiträge
    5.996
    Points
    40.380
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    have u tried this on a PSP yet because it doesnt work on the Lua Player for Windows


    [CENTER][IMG]http://img130.imageshack.us/img130/1640/acefcbanner2wo9.gif[/IMG]
    [SIZE=1][B]I'm soo hot[/B][/SIZE]
    [/CENTER]
    [SIZE=2][CENTER][/SIZE][/CENTER]
    [center]Sorry. No Advertising[/center]

  2. #392
    QJ Gamer Silver
    Points: 9.678, Level: 66
    Level completed: 7%, Points required for next Level: 372
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    The Migrant Fleet
    Beiträge
    908
    Points
    9.678
    Level
    66
    Downloads
    0
    Uploads
    0

    Standard

    worked on my psp

    make sure you save it as index.lua if your using LUA player with a lowser

    and did you take out the spaces that the forum makes? like between numbers and stuff?

  3. #393
    QJ Gamer Green
    Points: 40.380, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Ort
    Grand Line
    Beiträge
    5.996
    Points
    40.380
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    spaces? which ones
    [CENTER][IMG]http://img130.imageshack.us/img130/1640/acefcbanner2wo9.gif[/IMG]
    [SIZE=1][B]I'm soo hot[/B][/SIZE]
    [/CENTER]
    [SIZE=2][CENTER][/SIZE][/CENTER]
    [center]Sorry. No Advertising[/center]

  4. #394
    QJ Gamer Silver
    Points: 9.678, Level: 66
    Level completed: 7%, Points required for next Level: 372
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    The Migrant Fleet
    Beiträge
    908
    Points
    9.678
    Level
    66
    Downloads
    0
    Uploads
    0

    Standard

    Code:
    yellow = Color.new(255, 255, 0)
    blue = Color.new(0, 0, 255)
    orange = Color.new(223, 88, 6)
    grey = Color.new(94, 97, 111)
    black = Color.new(0, 0, 0)
    MAKE SURE THERES NO SPACES IN THE COLOR VALUE NUMBERS 
    background = Image.load("background.png")
    
    screen:blit(0, 0, background, false)
    screen.flip()
    screen.waitVblankStart(12  0)AND IN PLACES LIKE HERE IN BETWEEN TEH 12 AND 0
    
    screen:blit(0, 0, background, false)
    screen:print(150, 130, "Welcome To pspBaller Beta!", blue)
    screen.flip()
    screen.waitVblankStart(18  0) HERE 
    
    
    screen:blit(0, 0, background, false)
    screen:print(40, 150, "Thank you for waiting, now Press X for Tutorial", blue)
    screen.flip()
    screen.waitVblankStart(12  0) HERE 
    
    pad = Controls.read()
    
    if pad:cross() then
    screen:blit(0, 0, background, false)
    screen:print(40, 150, "Welcome to the Tutorial For pspBaller", blue)
    screen.flip()
    screen.waitVblankStart(40  0) HERE 
    end
    
     AND CHECK FOR RANY OTHER SPACES YOU MIGHT SEE  

  5. #395
    QJ Gamer Silver
    Points: 9.678, Level: 66
    Level completed: 7%, Points required for next Level: 372
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    The Migrant Fleet
    Beiträge
    908
    Points
    9.678
    Level
    66
    Downloads
    0
    Uploads
    0

    Standard

    anyone know what might be wrong with this code?
    its supposed to be a tic-tac-toe program with different features.
    one problem is that it doesnt start, and I dont know where yall get those errors, whenever a program doesnt run on my psp it just doesnt do anything.

    help please

    Code:
    background = Image.load("background.png")
    white = Image.load("white.png")
    black = Image.load("black.png")
    cursor = Image.load("cursor.png")
    
    cursorx = 247
    cursory = 123
    
    screen:blit(0, 0, background, false)
    screen:blit(247, 123, cursor)
    screen.flip()
    while true do
    screen.waitVblankStart()
    
    function white1()
    screen:blit(305, 31, white)
    screen.flip()
    screen.waitVblankStart()
    end
    
    function white2()
    screen:blit(305, 120, white)
    screen.flip()
    screen.waitVblankStart()
    end
    
    function white3()
    screen:blit(305, 211, white)
    screen.flip()
    screen.waitVblankStart()
    end
    
    function white4()
    screen:blit(217, 32, white)
    screen.flip()
    screen.waitVblankStart()
    end
    
    function white5()
    screen:blit(217, 117, white)
    screen.flip()
    screen.waitVblankStart()
    end
    
    function white6()
    screen:blit(217, 203, white)
    screen.flip()
    screen.waitVblankStart()
    end
    
    function white7()
    screen:blit(134, 31, white)
    screen.flip()
    screen.waitVblankStart()
    emd
    
    function white8()
    screen:blit(134, 117, white)
    screen.flip()
    screen.waitVblankStart()
    end
    
    function white9()
    screen:blit(134, 208, white)
    screen.flip()
    screen.waitVblankStart()
    
    function black1()
    screen:blit(305, 31, black)
    screen.flip()
    screen.waitVblankStart()
    end
    
    function black2()
    screen:blit(305, 120, black)
    screen.flip()
    screen.waitVblankStart()
    end
    
    function black3()
    screen:blit(305, 211, black)
    screen.flip()
    screen.waitVblankStart()
    end
    
    function black4()
    screen:blit(217, 32, black)
    screen.flip()
    screen.waitVblankStart()
    end
    
    function black5()
    screen:blit(217, 117, black)
    screen.flip()
    screen.waitVblankStart()
    end
    
    function black6()
    screen:blit(217, 203, black)
    screen.flip()
    screen.waitVblankStart()
    end
    
    function black7()
    screen:blit(134, 31, black)
    screen.flip()
    screen.waitVblankStart()
    emd
    
    function black8()
    screen:blit(134, 117, black)
    screen.flip()
    screen.waitVblankStart()
    end
    
    function black9()
    screen:blit(134, 208, black)
    screen.flip()
    screen.waitVblankStart()
    
    pad = Controls.read()
    
    if pad:left() then
    cursorx = cursorx - 85
    end
    
    if pad:right() then
    cursorx = cursorx + 85
    end
    
    if pad:up() then
    cursory = cursory + 76
    end
    
    if pad:down() then
    cursory = cursory - 76
    end
    
    if pad:square() then
    cursorx = cursorx - 85
    end
    
    if pad:circle() then
    cursorx = cursorx + 85
    end
    
    if pad:triangle() then
    cursory = cursory + 76
    end
    
    if pad:cross() then
    cursory = cursory - 76
    end
    
    if cursorx > 296 then
    if cursorx < 361 then
    if cursory > 12 then
    if cursory < 81 then
    if pad:l() then
    white1()
    end
    
    if cursorx > 296 then
    if cursorx < 361 then
    if cursory > 92 then
    if cursory < 175 then
    if pad:l() then
    white2()
    end
    
    if cursorx > 296 then
    if cursorx < 361 then
    if cursory > 185 then
    if cursory < 259 then
    if pad:l() then
    white3()
    end
    
    if cursorx > 205 then
    if cursorx < 284 then
    if cursory > 12 then
    if cursory < 81 then
    if pad:l() then
    white4()
    end
    
    if cursorx > 205 then
    if cursorx < 284 then
    if cursory > 92 then
    if cursory < 175 then
    if pad:l() then
    white5()
    end
    
    if cursorx > 205 then
    if cursorx < 284 then
    if cursory > 186 then
    if cursory < 258 then
    if pad:l() then
    white6()
    end
    
    if cursorx > 128 then
    if cursorx < 193 then
    if cursory > 12 then
    if cursory < 81 then
    if pad:l() then
    white7()
    end
    
    if cursorx > 128 then
    if cursorx < 193 then
    if cursory > 92 then
    if cursory < 175 then
    if pad:l() then
    white8()
    end
    
    if cursorx > 128 then
    if cursorx < 193 then
    if cursory > 186 then
    if cursory < 258 then
    if pad:l() then
    white9()
    end
    
    if cursorx > 296 then
    if cursorx < 361 then
    if cursory > 12 then
    if cursory < 81 then
    if pad:r() then
    black1()
    end
    
    if cursorx > 296 then
    if cursorx < 361 then
    if cursory > 92 then
    if cursory < 175 then
    if pad:r() then
    black2()
    end
    
    if cursorx > 296 then
    if cursorx < 361 then
    if cursory > 185 then
    if cursory < 259 then
    if pad:r() then
    black3()
    end
    
    if cursorx > 205 then
    if cursorx < 284 then
    if cursory > 12 then
    if cursory < 81 then
    if pad:r() then
    black4()
    end
    
    if cursorx > 205 then
    if cursorx < 284 then
    if cursory > 92 then
    if cursory < 175 then
    if pad:r() then
    black5()
    end
    
    if cursorx > 205 then
    if cursorx < 284 then
    if cursory > 186 then
    if cursory < 258 then
    if pad:r() then
    black6()
    end
    
    if cursorx > 128 then
    if cursorx < 193 then
    if cursory > 12 then
    if cursory < 81 then
    if pad:r() then
    black7()
    end
    
    if cursorx > 128 then
    if cursorx < 193 then
    if cursory > 92 then
    if cursory < 175 then
    if pad:r() then
    black8()
    end
    
    if cursorx > 128 then
    if cursorx < 193 then
    if cursory > 186 then
    if cursory < 258 then
    if pad:r() then
    black9()
    end
    Geändert von montrob (12-23-2005 um 12:19 PM Uhr)

  6. #396
    QJ Gamer Blue
    Points: 5.114, Level: 45
    Level completed: 82%, Points required for next Level: 36
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Beiträge
    152
    Points
    5.114
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    what's the code supposed to do?

  7. #397
    QJ Gamer Blue
    Points: 5.631, Level: 48
    Level completed: 41%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Beiträge
    375
    Points
    5.631
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    I have two questions. I want to start programing in lua so I decided to start on a simple program. How exactly do I make a menu and how do I tell the program to do a math problem?

  8. #398
    QJ Gamer Green
    Points: 40.380, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Ort
    Grand Line
    Beiträge
    5.996
    Points
    40.380
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    Code:
    if pad:select() then screen:save("screenshot.tga") end
    
    if pad:start() then
    break
    end
    
    end
    hmm im gettinga Weird Error when i try to Use Lua for Windows to Run pspBaller when i ran some code, it says "error: script.lua:52: no loop near 'end" here is the code by end
    [CENTER][IMG]http://img130.imageshack.us/img130/1640/acefcbanner2wo9.gif[/IMG]
    [SIZE=1][B]I'm soo hot[/B][/SIZE]
    [/CENTER]
    [SIZE=2][CENTER][/SIZE][/CENTER]
    [center]Sorry. No Advertising[/center]

  9. #399
    QJ Gamer Green
    Points: 11.125, Level: 69
    Level completed: 69%, Points required for next Level: 125
    Overall activity: 99,0%

    Registriert seit
    Oct 2005
    Ort
    Indiana
    Beiträge
    46
    Points
    11.125
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von KINGOFNOOBS
    Code:
    if pad:select() then screen:save("screenshot.tga") end
     
    if pad:start() then
    break
    end
     
    end
    hmm im gettinga Weird Error when i try to Use Lua for Windows to Run pspBaller when i ran some code, it says "error: script.lua:52: no loop near 'end" here is the code by end
    You have an extra end at the end of it. If it is ending a loop, then thats a different story. If you intend to loop it, then make sure there is a loop to start it off.
    [SIZE=1][CENTER]Some of my accomplishments in the Sonic community:
    [INDENT][SIZE=1][URL="http://www.s2beta.com/forums/index.php?showtopic=8365"]Sonic in Chaotix (Revision 2)[/URL][/SIZE][SIZE=1]
    [URL="http://www.s2beta.com/forums/index.php?showtopic=8116"]Knuckles' Chaotix Art Editor C++ Port[/URL][/SIZE][/INDENT][/CENTER]
    [/SIZE]

  10. #400
    QJ Gamer Green
    Points: 40.380, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Ort
    Grand Line
    Beiträge
    5.996
    Points
    40.380
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    hmm how would u make it to make it so when u press lets say, Right on the PSP Pad it moves a Object, and how would u make it so u could control how much it moves, and also how would it know what object move?
    [CENTER][IMG]http://img130.imageshack.us/img130/1640/acefcbanner2wo9.gif[/IMG]
    [SIZE=1][B]I'm soo hot[/B][/SIZE]
    [/CENTER]
    [SIZE=2][CENTER][/SIZE][/CENTER]
    [center]Sorry. No Advertising[/center]

  11. #401
    QJ Gamer Blue
    Points: 5.303, Level: 46
    Level completed: 77%, Points required for next Level: 47
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Beiträge
    82
    Points
    5.303
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Neodudeman
    For control the thing, the code Would be,
    Code:
    x=10
    y=10
    dude = Image.load("dude.png")
    
    while true do
      screen:clear()
      pad = Controls.read()
      screen:blit(x,y,dude)
      if pad:up()
      y = y-1
      end
      if pad:down()
      y = y+1
      end
      if pad:left()
      x = x-1
      end
      if pad:right()
      x = x+1
      end
      if pad:start()
      break
      end
      screen.flip()
      screen.waitVblankStart()
    end
    The first X=10 and y=10 shows the starting x+y coordinates, which tells us where the image will be

    dude = Image.load("dude.png") loads the image to be used. note that you can change the variable dude to anything you want, but remember to load the right png.

    the While true makes it so that all the code within the while and the end are run.

    the screen:clear() clears the screen

    the pad = Controls.read() gets the input buttons from the PSP. This is needed to use Any of the controls

    screen.blit(x,y,dude) displays the dude in all his glory. The blit uses the variable name from before, and not the file name

    the If statements say what happens IF certain buttons are pressed.
    though you may notice that when you press Up, the Y is subtracted. That goes against all logic! But on a PSP screen, and on many computers, the coordinates are 0,0 at the Top Left corner, which is why you subtract to go up.

    the If pad:start() is Definetly useful because it stops the program so you dont have to keep hittin home to quit.
    and the screen:flip/Vblank thing display the image

    thus concludes simple controlling of an image.
    That's how to control an image with the D-Pad

    Zitat Zitat von Neodudeman
    the analog stick is a different story Entirely. Its function isnt as linear and simple as the D-Pad's.

    the analog stick ranges in intensity from -128 to 128, but can produce values lower than 32 even when it's centered, making it unreliable without the proper code.
    Code:
    pad = Controls.read()
    ax = pad:analogX()
    ay = pad:analogY()
    if math.abs(ax) > 32 then
      x = x + ax / 50
    end
    if math.abs(ay) > 32 then
      y = y + ay / 50
    end
    Ok. this one Looks tricky, but is actually pretty simple.
    First, the pad = Controls finds the inputs and what not.
    Here, ax and ay look for the analog's movement along the X and Y axis, indetified as analogX() and analogY()
    Now, the If statement.
    If math.abs(ax) > 32 then
    remember how i said that the analog can produce values below 32 even when centered? well this statement helps buffer that.
    the math.abs(ax) just means the ABSolute value of the ax number. Absolute value changes negative numbers into positive, so that if we get a -32, it'll change it to positive 32. the > 32 makes sure that the absolute value is greater than 32, which is Really what the buffer is.
    after all that is tried and set, the x = x + ax / 50 is the adding of that X intensity of the analog to the actual variable x. the /50 is to dull the intensity of the analog. Without it, the x coordinate would be going through some Crazy numbers FAST. So, to lower the addition, we just divide.

    See?
    Any questions?
    That's controlling with the Analog!

    Hope that helps!

  12. #402
    QJ Gamer Green
    Points: 40.380, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Ort
    Grand Line
    Beiträge
    5.996
    Points
    40.380
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    so for my game, pspBaller ( i think u have seen it ) which way would better?
    [CENTER][IMG]http://img130.imageshack.us/img130/1640/acefcbanner2wo9.gif[/IMG]
    [SIZE=1][B]I'm soo hot[/B][/SIZE]
    [/CENTER]
    [SIZE=2][CENTER][/SIZE][/CENTER]
    [center]Sorry. No Advertising[/center]

  13. #403
    QJ Gamer Blue
    Points: 5.303, Level: 46
    Level completed: 77%, Points required for next Level: 47
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Beiträge
    82
    Points
    5.303
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    pspBaller? Err... lol, i haven't seen it. Though i'm willing to look

  14. #404
    QJ Gamer Blue
    Points: 5.303, Level: 46
    Level completed: 77%, Points required for next Level: 47
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Beiträge
    82
    Points
    5.303
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    Thoughhhhhhhh... not now... I need sleep now.. lol... it's 4 am here good night!

    ACTUALLY

    That game is lookin pretty sweet! I would recommend using the Analog stick, just because it feels nicer.. Though it depends on your engine. If it's REALLY linear, like, if 1+1=2 then you'd have to go with D-Pad, because the Analog outputs stuff like 89.23 and what not. BUT If it's a kinda Speeded Engine, like, If D-Pad, x=x+d-pad:left Then I would Totally recommend putting in analog stick to the addition, though the math would be harder.
    Geändert von Neodudeman (12-24-2005 um 12:36 AM Uhr)

  15. #405
    QJ Gamer Green
    Points: 40.380, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Ort
    Grand Line
    Beiträge
    5.996
    Points
    40.380
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    http://forums.qj.net/psp-development-forum/

    and also another question, how would u set a collision of a object?

    like if i wanted it to be like if the ball hits something it just simply bouces back up?
    [CENTER][IMG]http://img130.imageshack.us/img130/1640/acefcbanner2wo9.gif[/IMG]
    [SIZE=1][B]I'm soo hot[/B][/SIZE]
    [/CENTER]
    [SIZE=2][CENTER][/SIZE][/CENTER]
    [center]Sorry. No Advertising[/center]

  16. #406
    QJ Gamer Blue
    Points: 5.303, Level: 46
    Level completed: 77%, Points required for next Level: 47
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Beiträge
    82
    Points
    5.303
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    lol... and Suddenly Things Went Bad....

    Collision is Not my forte. lol. If i knew collision, I would be Out there in the Ether man... But what i Can tell you is that you're going to be needing some angle algorithms if you want to do some bouncing off walls.

    Possibly you can assign certain areas of the screen as "walls" ? Maybe like, when the ball Touches a wall, reverse the x, or y, depending on the wall. Like if it was a Top or Bottom wall, reverse the Y, so that it would still travel the X coordinate, but would "bounce" off the Y. See? and it if was a vertical wall, reverse the X.

    Sorry, but i Seriously have to sleep now.. lol. I wish i could help more, but i'm about to keel over with sleep deprevation. Good Night!

  17. #407
    QJ Gamer Blue
    Points: 4.995, Level: 45
    Level completed: 23%, Points required for next Level: 155
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Beiträge
    122
    Points
    4.995
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    to make borders do like this :
    Code:
    --set these limits for your character to be kept onscreen
    --x and y are your characters cordinates
    
    leftlimit = 10
    rightlimit = 460
    uplimit = 20
    downlimit = 260
    
    --if statement added during control init (enforcing limits)
    if x<=leftlimit then x=leftlimit
    	elseif x>=rightlimit then x=rightlimit end
    	if y<=uplimit then y=uplimit
    	elseif y>=downlimit then y=downlimit end
    Also, I wonder if it is possible to have pics in an array or if they only hold numbers and how do I call an array?

  18. #408
    QJ Gamer Blue
    Points: 5.114, Level: 45
    Level completed: 82%, Points required for next Level: 36
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Beiträge
    152
    Points
    5.114
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    i have some questions about the math.random() function and music files

    1. How would i make an enemy appear on the x axis in spaces like this(not exactly like that, but you get it):
    -------|---------------|----|----------|----------|
    |, representing my enemy

    2. with wav files, what does the config on them got to be? or is there a program i can use to make xm's or mod files?

  19. #409
    QJ Gamer Green
    Points: 40.380, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Ort
    Grand Line
    Beiträge
    5.996
    Points
    40.380
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    ahh another question, how exactly would i make a tile set? like u want to play more then one object in more then one place, would u just simply do:

    tile
    x=1
    y=1

    tile
    x=2
    y=2

    or would u keep using the Screen:Blit Command?
    [CENTER][IMG]http://img130.imageshack.us/img130/1640/acefcbanner2wo9.gif[/IMG]
    [SIZE=1][B]I'm soo hot[/B][/SIZE]
    [/CENTER]
    [SIZE=2][CENTER][/SIZE][/CENTER]
    [center]Sorry. No Advertising[/center]

  20. #410
    QJ Gamer Blue
    Points: 4.995, Level: 45
    Level completed: 23%, Points required for next Level: 155
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Beiträge
    122
    Points
    4.995
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    a tile set? you mean like a map or such?

  21. #411
    QJ Gamer Green
    Points: 40.380, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Apr 2006
    Ort
    Grand Line
    Beiträge
    5.996
    Points
    40.380
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    yea exactly what i mean, but i mean like how would u have it to make it each object on the map have diffrent properties
    [CENTER][IMG]http://img130.imageshack.us/img130/1640/acefcbanner2wo9.gif[/IMG]
    [SIZE=1][B]I'm soo hot[/B][/SIZE]
    [/CENTER]
    [SIZE=2][CENTER][/SIZE][/CENTER]
    [center]Sorry. No Advertising[/center]

  22. #412
    QJ Gamer Blue
    Points: 4.995, Level: 45
    Level completed: 23%, Points required for next Level: 155
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Beiträge
    122
    Points
    4.995
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Well I aint sure on this but I guess something like this would work

    Code:
    System.usbDiskModeActivate()
     
    tiles = Image.load("tiles.png")
     
    map = {
    	"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm",
    	"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm",
    	"mmeaaaaaaaaaaaaaaaaaaaaaaaafmm",
    	"mmdpnnnnnnnnnnnnnnnnnnnnnnpbmm",
    	"mmdokcccccclnkccccccccccclnbmm",
    	"mmdojaaaaafdnbmmmmmmmmmmmdnbmm",
    	"mmdooooooobdnbmmmmmmmmmmmdnbmm",
    	"mmdokccclobdnbmmmmmmmmmmmdnbmm",
    	"mmdobmmmdobdnbmmmmmmmmmmmdnbmm",
    	"mmdobmmmdobdnjaaaaaaaaaafdnbmm",
    	"mmdobmmmdpbdnnnnnnnnnnnnbdnbmm",
    	"mmdobmmmhcghcccccccccclnbdnbmm",
    	"mmdojaaaaaaaaaaaaaaaaainjinbmm",
    	"mmdpnnnnnnnnnnnnnnnnnnnnnnpbmm",
    	"mmhccccccccccccccccccccccccgmm",
    	"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm",
    	"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm"
    }
     
    function drawTile(tile, x, y)
    	local tileX = math.mod(tile, 4)
    	local tileY = math.floor(tile / 4)
    	screen:blit(16 * x, 16 * y, tiles, 17 * tileX + 1, 17 * tileY + 1, 16, 16, false)
    end	
     
    while true do
    	pad = Controls.read()
    	if pad:start() then break end
    	screen:clear()
    	for y = 1, 17 do
    		line = map[y]
    		for x = 1, 30 do
    			tile = string.byte(line, x) - string.byte("a")
    			drawTile(tile, x - 1, y - 1)
    		end
    	end
    	screen.waitVblankStart()
    	screen:flip()
    end

  23. #413
    QJ Gamer Blue
    Points: 5.114, Level: 45
    Level completed: 82%, Points required for next Level: 36
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Beiträge
    152
    Points
    5.114
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von monster356
    i have some questions about the math.random() function and music files

    1. How would i make an enemy appear on the x axis in spaces like this(not exactly like that, but you get it):
    -------|---------------|----|----------|----------|
    |, representing my enemy

    2. with wav files, what does the config on them got to be? or is there a program i can use to make xm's or mod files?
    can someone give me a hand here

    this was my post from before(in the quote...DUH)

  24. #414
    Points: 4.715, Level: 43
    Level completed: 83%, Points required for next Level: 35
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Beiträge
    36
    Points
    4.715
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von monster356
    Originally Posted by monster356
    i have some questions about the math.random() function and music files

    1. How would i make an enemy appear on the x axis in spaces like this(not exactly like that, but you get it):
    -------|---------------|----|----------|----------|
    |, representing my enemy
    can someone give me a hand here

    this was my post from before(in the quote...DUH)
    Try using something like this within your main loop:

    if math.random(1,300) == 150 then
    addEnemy(math.random(100, 400))

    replace the math.random values with your own to define how frequently enemies will appear, replace the 100,400 values with your own x,y values to give the area spread your enemy will appear in, and define your enemy image as "Enemy".... I think... dont hold me to that. :)

  25. #415
    Points: 4.313, Level: 41
    Level completed: 82%, Points required for next Level: 37
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    19
    Points
    4.313
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    hey it's monster356, i got banned, for like no reason....no one pmed me with a warning, and no one told me i was going to get banned......


    so, the addEnemy is a blit?

  26. #416
    Points: 4.281, Level: 41
    Level completed: 66%, Points required for next Level: 69
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Beiträge
    14
    Points
    4.281
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    hey all,
    i've finally decided on a game to make with lua, but am quite new to it. I understand basic programming (mostly in BASIC and Fortran, a little C++, from engineering school), but not so much for gaming programs. The game is relatively simple, but there are a few hurdles I need to overcome to make it happen.

    Anyway.... the game I have in mind is known as "SameGame" for PC or "Macigame" for MAC as well as many other versions/clones. Essentially, the game is a grid of tiles that when 2 or more tiles touch they can be selected and removed from the grid, whereupon the grid then "collapses" depending on what is removed. Clearing the grid fully and/or highscore is the object of the game.

    Some of my initial problems include: (again, I am new to game or graphics-based programming so I don't even know how problematic they may be)
    1. Creating a known-sized grid built from randomly selected tiles. i.e. I can build a pre-arranged grid from a tileset(similar to the pacman style gameboards) but am unsure how to make it randomly generated.
    2. Use of a cursor to select blocks of touching tiles, where when the cursor is placed over a suitable group this group would become highlighted, or selectable to be removed.

    Any help or pointing me in the right direction is greatly appreciated.
    Thanks...

  27. #417
    Points: 4.266, Level: 41
    Level completed: 58%, Points required for next Level: 84
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    22
    Points
    4.266
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    hey I'm kinda a newbie at this but here's my question. I'm making a fighter and I made it so that the character can move to each side of the screen and not go past but I want to make it so that the image changes so that it faces the direction it's going. can someone help me?

  28. #418
    QJ Gamer Gold
    Points: 12.479, Level: 73
    Level completed: 8%, Points required for next Level: 371
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    GA | Banned: 3 | Warned: 3
    Beiträge
    2.253
    Points
    12.479
    Level
    73
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Ace Hih
    hey I'm kinda a newbie at this but here's my question. I'm making a fighter and I made it so that the character can move to each side of the screen and not go past but I want to make it so that the image changes so that it faces the direction it's going. can someone help me?
    if facing==1 then
    screen:blit(X,Y,Pic facing left)
    end

    if facing==2 then
    screen:blit(X,Y,pic facing right)
    end

    if pad:left() then
    facing = 1
    imagex = imagex - 3
    end

    if pad:right() then
    facing = 2
    imagex = imagex +3
    end

  29. #419
    Points: 4.266, Level: 41
    Level completed: 58%, Points required for next Level: 84
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    22
    Points
    4.266
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Thank you so much. This thread is great!

  30. #420
    Points: 4.266, Level: 41
    Level completed: 58%, Points required for next Level: 84
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    22
    Points
    4.266
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    I hate to be annoying but for some reason it won't work.It worked before I added the code with the comments. here's my code:

    System.usbDiskModeActivat e ()

    field = Image.load("Naruto forestc.PNG")
    block3 = Image.load("player.PNG")
    player = Image.load(player2.PNG")

    blockposX = 152
    blockposY = 195

    while true do
    screen:blit(0, 0, field)
    screen:blit(blockposX, blockposY, block3)

    if blockposX <= 2 then
    blockposX = 1
    end

    if blockposX >= 447 then
    blockposX = 448
    end

    if facing==1 then --------This section
    screen:blit(blockposX, blockposY, player)
    end

    if facing==2 then --------This section
    screen:blit(blockposX, blockposY, block3)
    end

    pad = Controls.read()

    if pad:left() then
    facing = 1 ---------This Line
    blockposX = blockposX - 5
    end

    if pad:right() then
    facing = 2 ---------This Line
    blockposX = blockposX + 5
    end

    screen.waitVblankStart()
    screen.flip()


    if pad:start() then
    break
    end
    end

    What did I do wrong?


    Oh yeah and I ripped part of the code from someones example on this page for learning purposes. So props to them
    Geändert von Ace Hih (01-20-2006 um 09:47 PM Uhr)


 
Seite 14 von 342 ErsteErste ... 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 64 114 ... LetzteLetzte

Tags for this Thread

Forumregeln

  • Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
  • Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
  • Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
  • Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.
  •  





Alle Zeitangaben in WEZ -8. Es ist jetzt 08:58 PM Uhr.

Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © , Caputo Media, LLC. All Rights Reserved. Cluster .