Seite 113 von 342 ErsteErste ... 13 63 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 163 213 ... LetzteLetzte
Zeige Ergebnis 3.361 bis 3.390 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; Just use this: if player.x == enemy.x then FireBullet() end if bullet.y > player.y then bullet.y = bullet.y - 4 ...

  
  1. #3361
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    Just use this:

    if player.x == enemy.x then
    FireBullet()
    end
    if bullet.y > player.y then
    bullet.y = bullet.y - 4
    end


    This will make it, so when you fire the bullet, it will come straight down. And it will only fire if the player is directly under the enemy.



  2. #3362
    Points: 3.957, Level: 40
    Level completed: 4%, Points required for next Level: 193
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    36
    Points
    3.957
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    ok i guess that will work thnx

  3. #3363
    is not posting very often
    Points: 33.152, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 99,6%

    Registriert seit
    Feb 2006
    Ort
    omnipresent
    Beiträge
    5.162
    Points
    33.152
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    i see what you are doing!

    easy, as long asyour player saysy at the same 'y' location, just make its x loaction be called bulletdestination then make thhe bullets go to there
    What did we think the world would look like in 2015?

    Zitat Zitat von Abe
    Either way, if you don't know, don't guess. Stick to answering questions about stuff you're qualified to answer, like Pokemon questions or something along those lines.
    http://forums.qj.net/501501-post26.html

  4. #3364
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    You can also make it a little more tolerant. Like it the player is sort of under it. Like this:
    if (player.x + 10) == enemy.x then
    FireBullet()
    end
    if (player.x - 10) == enemy.x then
    FireBullet()
    end
    This will make it so if the player is kind of under the enemy, it will fire. You can also change the speed of the bullet from 4 to something faster.
    -= Double Post =-
    Zitat Zitat von Glynnder
    i see what you are doing!

    easy, as long asyour player saysy at the same 'y' location, just make its x loaction be called bulletdestination then make thhe bullets go to there
    Yeah but you don't want the bullet to follow the player. Bullets go in straight lines not loops and zigzags.
    Geändert von ARza (08-25-2006 um 06:47 AM Uhr) Grund: Automerged Doublepost

  5. #3365
    QJ Gamer Blue
    Points: 4.119, Level: 40
    Level completed: 85%, Points required for next Level: 31
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    106
    Points
    4.119
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    How can I make the text from Image2 go into Image1??? Images were borrowed from ProgramLua to show an example...

    **Image1**

    **Image2**

  6. #3366
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    Well image 2 is transparent, so just paste 2 on top of 1. Like this:

    screen:blit(0,0,image1)
    screen:blit(0,0,image2)

  7. #3367
    QJ Gamer Blue
    Points: 4.119, Level: 40
    Level completed: 85%, Points required for next Level: 31
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    106
    Points
    4.119
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    Thanks ARza, sorry for using ur images without asking u...

  8. #3368
    No longer a community member.
    Points: 25.679, Level: 96
    Level completed: 33%, Points required for next Level: 671
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    2
    Points
    25.679
    Level
    96
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Dr.Gringo
    Thanks ARza, sorry for using yours and Appleseed629's images without asking u...
    Corrected :).

  9. #3369
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    It's cool, you weren't really using them. Only for an example.

  10. #3370
    No longer a community member.
    Points: 25.679, Level: 96
    Level completed: 33%, Points required for next Level: 671
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    2
    Points
    25.679
    Level
    96
    Downloads
    0
    Uploads
    0

    Standard

    How do I make the player move if the player moves the analog stick in Lua?

  11. #3371
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    You know you dont know the concept when you always use game specifics when asking for help ;)

    You should be asking how to manipulate a variable, using hte analog stick...

    I havent used LUA in forever, so i dont know the control name for the analog stick, but it ranges from -128 - +128, so say if pad:analogX() > 50 then increase_x_co-ordinate...

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  12. #3372
    QJ Gamer Blue
    Points: 4.119, Level: 40
    Level completed: 85%, Points required for next Level: 31
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    106
    Points
    4.119
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    Once you have blitted a text image how do you change to another??? Is it going to overlap or would it just substitute...

  13. #3373
    No longer a community member.
    Points: 25.679, Level: 96
    Level completed: 33%, Points required for next Level: 671
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    2
    Points
    25.679
    Level
    96
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Dr.Gringo
    LOL, Yeah sure Appleseed629
    I assume you don't know that ARza and I made it together? Look in the credits.

  14. #3374
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SG57
    You know you dont know the concept when you always use game specifics when asking for help ;)

    You should be asking how to manipulate a variable, using hte analog stick...

    I havent used LUA in forever, so i dont know the control name for the analog stick, but it ranges from -128 - +128, so say if pad:analogX() > 50 then increase_x_co-ordinate...
    It's actually from -127 to 128. -128 will give you an error.

  15. #3375
    No longer a community member.
    Points: 25.679, Level: 96
    Level completed: 33%, Points required for next Level: 671
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    2
    Points
    25.679
    Level
    96
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SG57
    You know you dont know the concept when you always use game specifics when asking for help ;)

    You should be asking how to manipulate a variable, using hte analog stick...

    I havent used LUA in forever, so i dont know the control name for the analog stick, but it ranges from -128 - +128, so say if pad:analogX() > 50 then increase_x_co-ordinate...
    Thanks .

    Zitat Zitat von ARza
    It's actually from -127 to 128. -128 will give you an error.
    Thanks !

  16. #3376
    is not posting very often
    Points: 33.152, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 99,6%

    Registriert seit
    Feb 2006
    Ort
    omnipresent
    Beiträge
    5.162
    Points
    33.152
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    lol, ouch no recognition.
    and its analog_x methinks
    What did we think the world would look like in 2015?

    Zitat Zitat von Abe
    Either way, if you don't know, don't guess. Stick to answering questions about stuff you're qualified to answer, like Pokemon questions or something along those lines.
    http://forums.qj.net/501501-post26.html

  17. #3377
    No longer a community member.
    Points: 25.679, Level: 96
    Level completed: 33%, Points required for next Level: 671
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    2
    Points
    25.679
    Level
    96
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Glynnder
    lol, ouch no recognition.
    and its analog_x methinks
    Tell me about it. Every person who thinks ProgramLua is great knows that I did half of the work. Except Dr. Gringo.

    And... hey, Glynnder, you keep changing your sig. Maybe I should make one for ya? That'll be 500 poitns please. Lol!

  18. #3378
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    As most of you probably know, I'm making a game where you draw designs. I have the drawing part done. When you press X on a square, it turns it black. O turns it white. Well, when trying it on my PSP it runs horribly slow. I am using PSPmillionaire's scrolling tile engine. I modified it to work. But when it's on a PSP is runs slow. I've tried .16 and .20. I even tried the .20 mod by Cools and set the CPU to 333 and it still runs slow. Here's my code, any suggestions?

    Code:
    -- Define Variables
    --==============
    currenty = 3
    currentx = 3
    
    Colliding = false
    --Images
    
    black = Color.new(0,0,0) 
    white = Color.new(255,255,255)
    Images = { }
    Images[1] = Image.createEmpty(5,5)
    Images[2] = Image.createEmpty(5,5)
    Images[1]:clear(black)
    Images[2]:clear(white)
    Images[50] = Image.load("Selector.png")
    base = Image.load("Base.png")
    TILE_SIZE = 6
    CHARACTER_SIZE = 7
    MAP_WIDTH = 42
    MAP_HEIGHT = 42
    SCREEN_HEIGHT = 272
    SCREEN_WIDTH = 480
    SCREEN_WIDTH_BOUNDARY = 480
    SCREEN_HEIGHT_BOUNDARY = 272
    SCROLL_BOUNDARY = TILE_SIZE*7.5
    SCROLL_BOUNDARY2 = TILE_SIZE*2.5
    STAT_BOX_HEIGHT = 40
    MX = TILE_SIZE
    MY = TILE_SIZE
    player = {speed = 6,x = 11, y = 11}
    
     map = { }
       map[1] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[2] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[3] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[4] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[5] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[6] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[7] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[8] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[9] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
      map[10] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
        map[11] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[12] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[13] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[14] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[15] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[16] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[17] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[18] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[19] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
      map[20] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
        map[21] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[22] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[23] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[24] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[25] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[26] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[27] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[28] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[29] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
      map[30] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
        map[31] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[32] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[33] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[34] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[35] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[36] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[37] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[38] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
       map[39] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
      map[40] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
     map[41] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
     map[42] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
    
    
    
    function CollisionOverlaps(px, py)
      px = px + (MX-TILE_SIZE)
       py = py + (MY-TILE_SIZE)
       mapx1 = math.floor(px / TILE_SIZE + 1)
       mapy1 = math.floor(py / TILE_SIZE + 1)
       mapx2 = math.floor((px+CHARACTER_SIZE) / TILE_SIZE + 1)
       mapy2 = math.floor(py / TILE_SIZE + 1)
       mapx3 = math.floor(px / TILE_SIZE + 1)
       mapy3 = math.floor((py+CHARACTER_SIZE) / TILE_SIZE + 1)
       mapx4 = math.floor((px+CHARACTER_SIZE) / TILE_SIZE + 1)
       mapy4 = math.floor((py+CHARACTER_SIZE) / TILE_SIZE + 1)
    
       id1 = getMapTile(mapy1, mapx1)
       id2 = getMapTile(mapy2, mapx2)
       id3 = getMapTile(mapy3, mapx3)
       id4 = getMapTile(mapy4, mapx4)
    
    
    
    if id1 < 50 and id2 < 50 and id3 < 50 and id4 < 50  then
    Colliding = false
    else
    Colliding = true
    end
    end
    
    
    
    
    function getMapTile(y,x)
       if x >= 0 and x <= MAP_WIDTH and y >= 0 and y <= MAP_HEIGHT then
          img = map[y][x] 
       return img
    else return 0
    end
    end
    
    
    function drawMap(mapDrawX, mapDrawY)
    
       mapx = math.floor(mapDrawX / TILE_SIZE)
       mapy = math.floor(mapDrawY / TILE_SIZE)
       xoff = math.floor(mapDrawX and (TILE_SIZE-1))
       yoff = math.floor(mapDrawY and (TILE_SIZE-1))
       xoff = math.floor(mapDrawX - mapx*TILE_SIZE)
       yoff = math.floor(mapDrawY - mapy*TILE_SIZE)
    
       for x = 2,42 do
          for y = 2,42 do
            img = getMapTile(mapy+y, mapx+x)
             if img > 0 then screen:blit(x*TILE_SIZE - xoff, y*TILE_SIZE - yoff,Images[img]) end
          end
       end
    end
    
    
    
    
    function PositionPlayer(x, y)
       screen:blit(x,y,Images[50])
    end
    
    --Main Loop
    oldpad = Controls.read()
    while true do
    screen:clear()
    screen:blit(0,0,base)
    
    oldPlayerX = player.x
    oldPlayerY = player.y
    pad = Controls.read()
    if pad:up() and oldpad:up() ~= pad:up() then
    player.y = player.y - 6
    currenty = currenty - 1
    end
    if pad:down() and oldpad:down() ~= pad:down() then
    player.y = player.y + 6
    currenty = currenty + 1
    end
    if pad:right() and oldpad:right() ~= pad:right() then
    player.x = player.x + 6
    currentx = currentx + 1
    end
    if pad:left() and oldpad:left() ~= pad:left() then
    player.x = player.x - 6
    currentx = currentx - 1
    end
    if pad:up() and oldpad:up() ~= pad:up() and pad:square() then
    player.y = player.y - 24
    currenty = currenty - 4
    end
    if pad:down() and oldpad:down() ~= pad:down() and pad:square() then
    player.y = player.y + 24
    currenty = currenty + 4
    end
    if pad:right() and oldpad:right() ~= pad:right() and pad:square() then
    player.x = player.x + 24
    currentx = currentx + 4
    end
    if pad:left() and oldpad:left() ~= pad:left() and pad:square() then
    player.x = player.x - 24
    currentx = currentx - 4
    end
    if player.y > 245 then
    player.y = 245
    end
    if player.x > 245 then
    player.x = 245
    end
    if player.y < 11 then
    player.y = 11
    end
    if player.x < 11 then
    player.x = 11
    end
    if currentx > 42 then
    currentx = 42
    end
    if currentx < 3 then
    currentx = 3
    end
    if currenty > 42 then
    currenty = 42
    end
    if currenty < 3 then
    currenty = 3
    end
    if pad:circle() and oldpad:circle() ~= pad:circle() then
    map[currenty][currentx] = 2
    end
    if pad:cross() and oldpad:cross() ~= pad:cross() then
    map[currenty][currentx] = 1
    end
    CollisionOverlaps(player.x,player.y)
    if Colliding == true then
    player.x = oldPlayerX
    player.y = oldPlayerY
    else
    end
    MXa = math.floor(MX)
    MYa = math.floor(MY)
    drawMap(MXa,MYa)
    PositionPlayer(player.x, player.y)
    --PrintStats(player)
    screen.waitVblankStart()
    screen:flip()
    oldpad = pad
    end

  19. #3379
    QJ Gamer Blue
    Points: 4.119, Level: 40
    Level completed: 85%, Points required for next Level: 31
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    106
    Points
    4.119
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    Once you have blitted a text image how do you change to another??? Is it going to overlap or would it just substitute...

    I did know that Appleseed629 did half of programlua however i said arza because he was on the above post, rofl

  20. #3380
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Dr.Gringo
    Once you have blitted a text image how do you change to another??? Is it going to overlap or would it just substitute...

    why did you post the same question twice?? anyway, what do you mean by "text image"?? like an image with text on it?? it so, just clear the screen, and blit the next image. OR, keep the background image the same, and just substitue the text.
    --------------------------------------------------------------------------------------

  21. #3381
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    I did this:

    current = 1
    image = {}
    image[1] = "image.png"
    image[2] = "image.png"
    image[3] = "image.png"
    image[4] = "image.png"
    current_image = nil
    current_image = Image.load(image[current])

    Understand? If you change the variable "current" the image will change.

  22. #3382
    No longer a community member.
    Points: 25.679, Level: 96
    Level completed: 33%, Points required for next Level: 671
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    2
    Points
    25.679
    Level
    96
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Dr.Gringo
    Once you have blitted a text image how do you change to another??? Is it going to overlap or would it just substitute...

    I did know that Appleseed629 did half of programlua however i said arza because he was on the above post, rofl
    Then why did you say, "Sure, Appleseed629." That I wonder...

    ProgramLua is like that: it changes to another image when you press a button. If you want two images at the same time, you're gonan have to move the second by 1 more in the x/y coordinate.

  23. #3383
    QJ Gamer Blue
    Points: 4.119, Level: 40
    Level completed: 85%, Points required for next Level: 31
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    106
    Points
    4.119
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    Arza if i do it your method would i have to Load all the images at the beginning of my script

  24. #3384
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Dr.Gringo
    Arza if i do it your method would i have to Load all the images at the beginning of my script

    not necessaliry. but you have to load them before yu use them.

    and try not to load them in your while true do loop, thats make your game VERY VERY slow.
    --------------------------------------------------------------------------------------

  25. #3385
    QJ Gamer Blue
    Points: 4.119, Level: 40
    Level completed: 85%, Points required for next Level: 31
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    106
    Points
    4.119
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    When I clear the screen how can i keep my background and only change the picture with the text.

    Example:

    Code:
    oldpad = Controls.read()
    while true do
    pad=Controls.read()
    screen:clear()
    screen:blit(0, 0, clear, false)
    
    if pad:down() and oldpad:down() ~= pad:down() and current = 20 then
    pictext = Image.load("images/pictext.png")
    screen:blit(0, 0, pictext, false)
    end
    
    screen.waitVblankStart()
    oldpad = pad
    screen.flip()

  26. #3386
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Dr.Gringo
    When I clear the screen how can i keep my background and only change the picture with the text.

    Example:

    Code:
    oldpad = Controls.read()
    while true do
    pad=Controls.read()
    screen:clear()
    screen:blit(0, 0, clear, false)
    
    if pad:down() and oldpad:down() ~= pad:down() and current = 20 then
    pictext = Image.load("images/pictext.png")
    screen:blit(0, 0, pictext, false)
    end
    
    screen.waitVblankStart()
    oldpad = pad
    screen.flip()

    actually, ur gonna have to make an array:

    Code:
    text = {}
    text[1] = Image.load("yourtextimagename")
    -- etc.
    currentText = 0
    
    oldpad = Controls.read()
    
    while true do
    
    pad=Controls.read()
    screen:clear()
    screen:blit(0, 0, clear, false)
    
    if currentText ~= 0 then
    screen:blit(0, 0, text[currentText])
    end
    
    
    if pad:down() and oldpad:down() ~= pad:down() and current = 20 then
    currentText = 1
    end
    
    screen.waitVblankStart()
    oldpad = pad
    screen.flip()
    end
    --------------------------------------------------------------------------------------

  27. #3387
    Heroes never die
    Points: 8.645, Level: 62
    Level completed: 65%, Points required for next Level: 105
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    ...........
    Beiträge
    1.323
    Points
    8.645
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    what's wrong with this one
    Code:
    red = Color.new(255,0,0)
    black = Color.new(0,0,0)
    white = Color.new(255,255,255)
    
    menustatus = 1
    
    while true do
    screen:clear(black)
    pad = Controls.read()
    
    if pad:up() then
    menustatus = menustatus - 1
    screen.waitVblankStart(4)   
    end
    
    if pad:down() then
    menustatus = menustatus + 1
    screen.waitVblankStart(4)   
    end
    
    color={white, white, white}
    while true do
    screen:print(50, 50, "Play", color[1])
    screen:print(50,60,"Options", color[2])
    screen:print(50,70,"Exit", color[3])
    end
    color[menustatus]=red
    
    if menustatus == 1 then
        if pad:cross() then
        screen:clear()
        screen:print(50, 50, "Play", color[1])
        end
    end
    
    if menustatus == 2 then
        if pad:cross() then
        screen:clear()
        screen:print(50, 50, "Play", color[1])
        end
    end
    
    if menustatus == 3 then
        if pad:cross() then
        break
        end
    end
    
    if menustatus <= 0 then
        menustatus = 3
        end
    
    if menustatus => 4 then
       menustatus = 1
       end
    
    screen.flip()
    screen.waitVblankStart()
    end

  28. #3388
    QJ Gamer Bronze
    Points: 5.924, Level: 49
    Level completed: 87%, Points required for next Level: 26
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Earth, UK
    Beiträge
    457
    Points
    5.924
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von hallo007
    what's wrong with this one
    Code:
    red = Color.new(255,0,0)
    black = Color.new(0,0,0)
    white = Color.new(255,255,255)
    
    menustatus = 1
    
    while true do
    screen:clear(black)
    pad = Controls.read()
    
    if pad:up() then
    menustatus = menustatus - 1
    screen.waitVblankStart(4)   
    end
    
    if pad:down() then
    menustatus = menustatus + 1
    screen.waitVblankStart(4)   
    end
    
    color={white, white, white}
    while true do
    screen:print(50, 50, "Play", color[1])
    screen:print(50,60,"Options", color[2])
    screen:print(50,70,"Exit", color[3])
    end
    color[menustatus]=red
    
    if menustatus == 1 then
        if pad:cross() then
        screen:clear()
        screen:print(50, 50, "Play", color[1])
        end
    end
    
    if menustatus == 2 then
        if pad:cross() then
        screen:clear()
        screen:print(50, 50, "Play", color[1])
        end
    end
    
    if menustatus == 3 then
        if pad:cross() then
        break
        end
    end
    
    if menustatus <= 0 then
        menustatus = 3
        end
    
    if menustatus => 4 then
       menustatus = 1
       end
    
    screen.flip()
    screen.waitVblankStart()
    end
    You have two 'While true do' loops
    <<Put A message Here>>
    <<Just made another rubbish website visit it here.>>

  29. #3389
    QJ Gamer Bronze
    Points: 14.090, Level: 77
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    USA
    Beiträge
    496
    Points
    14.090
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    Working on a game. Here's my code.

    Code thats a problem -
    Code:
    EnemyList = {1,2,3,4,5,6}
           
          (REST OF CODE)
    
          if Enemy[EnemyList[target]].health <= 0 then
             Enemy[EnemyList[target]].state = "dead"
          end
    
          if Enemy[EnemyList[Length]].state = "dead" then
             screen:print(10, 130, "You killed all the enemies")
          end
    Example of my table -
    Code:
    Enemy = {}
    Enemy[1] = {name = "Zombie", damage = 3, health = 15, combatx = 300, combaty = 5, image = mzombie, state = "living"}
    Enemy[2] = {name = "Zombie", damage = 3, health = 20, combatx = 310, combaty = 15, image = mzombie2, state = "living"}
    The error I get is " 'then' expected near '=' "

    I probably didn't need to include all that information, but more is better then less. This is probably an easy solution also, but I don't care b/c im tired.

  30. #3390
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von CtrlAltDeleteDie
    Working on a game. Here's my code.

    Code thats a problem -
    Code:
    EnemyList = {1,2,3,4,5,6}
           
          (REST OF CODE)
    
          if Enemy[EnemyList[target]].health <= 0 then
             Enemy[EnemyList[target]].state = "dead"
          end
    
          if Enemy[EnemyList[Length]].state = "dead" then
             screen:print(10, 130, "You killed all the enemies")
          end
    Example of my table -
    Code:
    Enemy = {}
    Enemy[1] = {name = "Zombie", damage = 3, health = 15, combatx = 300, combaty = 5, image = mzombie, state = "living"}
    Enemy[2] = {name = "Zombie", damage = 3, health = 20, combatx = 310, combaty = 15, image = mzombie2, state = "living"}
    The error I get is " 'then' expected near '=' "

    I probably didn't need to include all that information, but more is better then less. This is probably an easy solution also, but I don't care b/c im tired.
    you need two '=' to compare:

    Code:
    EnemyList = {1,2,3,4,5,6}
           
          (REST OF CODE)
    
          if Enemy[EnemyList[target]].health <= 0 then
             Enemy[EnemyList[target]].state = "dead"
          end
    
          if Enemy[EnemyList[Length]].state == "dead" then
             screen:print(10, 130, "You killed all the enemies")
          end
    Example of my table -
    Code:
    Enemy = {}
    Enemy[1] = {name = "Zombie", damage = 3, health = 15, combatx = 300, combaty = 5, image = mzombie, state = "living"}
    Enemy[2] = {name = "Zombie", damage = 3, health = 20, combatx = 310, combaty = 15, image = mzombie2, state = "living"}
    --------------------------------------------------------------------------------------


 

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 07:53 AM Uhr.

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