Seite 259 von 342 ErsteErste ... 159 209 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 309 ... LetzteLetzte
Zeige Ergebnis 7.741 bis 7.770 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; i think there is already a squares port, named squarez look at the "top rated homebrew for 1.5 and OE" ...

  
  1. #7741
    QJ Gamer Bronze
    Points: 8.665, Level: 62
    Level completed: 72%, Points required for next Level: 85
    Overall activity: 0%

    Registriert seit
    Mar 2007
    Beiträge
    758
    Points
    8.665
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    i think there is already a squares port, named squarez
    look at the "top rated homebrew for 1.5 and OE" in the homebrew discussion forum

    that first one isn't too hard, all you need to do is get the bat to chase the mouse, collision function for cheese, and some other things
    that may seem hard now, but you'll think it's easy soon enough
    also, make sure you go all the way to the pong tutorial
    and look at the "snippets" too, they're like mini-tutorials



  2. #7742
    QJ Gamer Green
    Points: 5.971, Level: 50
    Level completed: 11%, Points required for next Level: 179
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    640
    Points
    5.971
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von michaelp
    i think there is already a squares port, named squarez
    look at the "top rated homebrew for 1.5 and OE" in the homebrew discussion forum

    that first one isn't too hard, all you need to do is get the bat to chase the mouse, collision function for cheese, and some other things
    that may seem hard now, but you'll think it's easy soon enough
    also, make sure you go all the way to the pong tutorial
    and look at the "snippets" too, they're like mini-tutorials
    Yes there is a port of squares, but not squares 2 so that was what I was thinking, and for the bat mouse thing, can I use this http://www.evilmana.com/tutorials/co...ase_player.php
    It makes sense, i was looking at that and i got reminded of the flash game and thought that it would be an easy port with some jpg files and stuff (maybe a week or twos worth?)

  3. #7743
    QJ Gamer Bronze
    Points: 8.665, Level: 62
    Level completed: 72%, Points required for next Level: 85
    Overall activity: 0%

    Registriert seit
    Mar 2007
    Beiträge
    758
    Points
    8.665
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    you can, but you will have to say that you did in the readme to prevent yourself from being flamed

  4. #7744
    QJ Gamer Green
    Points: 5.971, Level: 50
    Level completed: 11%, Points required for next Level: 179
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    640
    Points
    5.971
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von michaelp
    you can, but you will have to say that you did in the readme to prevent yourself from being flamed
    yea of course and maybe a credits section that says where I got it - back to the tutorials lol
    Geändert von Gam3freQ (07-19-2007 um 04:09 PM Uhr)

  5. #7745
    QJ Gamer Blue
    Points: 4.369, Level: 42
    Level completed: 10%, Points required for next Level: 181
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    246
    Points
    4.369
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    Here's a function that uses the GU for a fast resizing/flipping of images:

    Code:
    function Gu.blit(x, y, image, scale, flip)
    	
    	if not scale or type(scale) == "string" then 
    		flip = scale
    		scale = 1
    	end
    	
    	if flip then
    		if flip == "H" then
    			x_start = image:width()
    			y_start = 0
    			x_end  = 0
    			y_end = image:height()
    		elseif  flip == "V" then
    			x_start = 0
    			y_start = image:height()
    			x_end  = image:width()
    			y_end = 0
    		elseif flip == "HV" then
    			x_start = image:width()
    			y_start = image:height()
    			x_end = 0
    			y_end = 0
    		end
    	else
    		x_start = 0
    		y_start = 0
    		x_end = image:width()
    		y_end = image:height()
    	end
    	
    	width = (image:width()*scale)+x
    	height = (image:height()*scale)+y
    	temp = {
    	{x_start, y_start, x, y, 0},
    	{x_end, y_end, width, height, 0}
    	}
    	Gu.enable(Gu.TEXTURE_2D)
    	Gu.texImage(image)
    	Gum.drawArray(Gu.SPRITES, Gu.TEXTURE_32BITF+Gu.VERTEX_32BITF+Gu.TRANSFORM_2D, temp)
    end
    the argument "scale" is a multiplier for the size of the image, I.E. 0.5 is half size, 2 is double size, etc... If you leave this out the scale will default to 1

    the argument "flip" is a string, "H" flips horizontally, "V" flips it vertically, "HV" will flip it both ways.

    Because this uses the GU, you need to use Gu.start3d() and Gu.end3d(), also remember that you can't use the regular screen:blit function while the GU is running or lua player will crash.

    and, here's an example script for how to use it:

    Code:
    img = Image.load("image.png")
    
    pad = Controls.read()
    screen:clear()
    Gu.start3d() 
    Gu.blit( 20,  20, img, 0.5, "H")
    Gu.blit(100,  10, img, 1.5, "HV")
    Gu.blit(300,  10, img, "V")
    Gu.end3d() 
    screen:flip()
    
    while not pad:start() do
    	pad = Controls.read()
    end
    To rotate an image to any angle, see this old post I made on Evilmana for an example:

    http://www.forums.evilmana.com/index.php?topic=676.0

  6. #7746
    Banned from QJ for LIFE
    Points: 10.957, Level: 69
    Level completed: 27%, Points required for next Level: 293
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    1.557
    Points
    10.957
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    yes its to work out yourself, rather easy to be honest and i know only the BBB has you call it :P

  7. #7747
    QJ Gamer Green
    Points: 5.971, Level: 50
    Level completed: 11%, Points required for next Level: 179
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    640
    Points
    5.971
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von mraellis
    yes its to work out yourself, rather easy to be honest and i know only the BBB has you call it :P
    I figured it out lol. now I am on tutorial 10 wow never expected it to take so long just to get the hang of lua lol
    Geändert von Gam3freQ (07-19-2007 um 04:32 PM Uhr)

  8. #7748
    Banned from QJ for LIFE
    Points: 10.957, Level: 69
    Level completed: 27%, Points required for next Level: 293
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    1.557
    Points
    10.957
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    its weird, i am into and not into it... i keep doing what one of the other guys said about redoing it then leaving it then coming back. so even with completing all the evil mana tuts i don't know every done there to explain to people but if you was to make a simple project I'd probably understand a fair bit of the source. i need to buckle down and learn lua proper instead of toying with it.

    thanks to you making this post ( which i kinda thought omg post in the lua thread help you idiot at first to (( sorry :P )) ) now I'm gonna try actually learning proper

    p.s I've just hit tut 5 you was on ;)

  9. #7749
    QJ Gamer Green
    Points: 7.599, Level: 58
    Level completed: 25%, Points required for next Level: 151
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Belgium
    Beiträge
    594
    Points
    7.599
    Level
    58
    Downloads
    0
    Uploads
    0

    Standard

    Thank you meric for your help, :)
    I am not going to use it tho becaus the currentproject I am working on is a game with a faux3D engine. And this script, even if this is not "real" 3D, it still uses the GU to render in a 3D space, and a big part of the game uses blit so I would have to change to much in my sourcecode.

    Still, thank you for the help, it's better to know this now for future projects :)

  10. #7750
    Banned from QJ for LIFE
    Points: 10.957, Level: 69
    Level completed: 27%, Points required for next Level: 293
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    1.557
    Points
    10.957
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    Ok I've been doing the evil mana tutorials. I've kinda hit a snag at number 6 and cant work out why..

    here's the code.

    -- ******* Tables ********

    oldpad = Controls.read()

    green = Color.new(0,255,0)
    red = Color.new (255,0,0)
    blue = Color.new (0,0,255)

    currentEnemy = 1

    Enemy = { }
    Enemy[1] = { type = "gargoyle", health = 100 }
    Enemy[2] = { type = "vampire", health = 100 }
    Enemy[3] = { type = "goomba", health = 100 }
    Enemy[4] = { type = "ghost", health = 100 }
    Enemy[5] = { type = "zombie", health = 100 }

    Player = { }
    Player[1] = { weapon = "sword", health = 100 }
    Player[2] = { weapon = "knife", health = 100 }

    -- *****Main Loop******

    while true do


    pad = Controls.read()
    screen:clear()

    screenrint(5,10,"Player 1 Health: " .. Player[1].health,red)
    screenrint(5,20,"Player 1 Weapon: " .. Player[1].weapon,blue)
    screenrint(250,10,"Enemy Health: " .. Enemy[currentEnemy].health,green)
    screenrint(250,20,"Enemy Type: " .. Enemy[currentEnemy].type,green)

    if currentEnemy == 5 and Enemy[currentEnemy].health == 0 then
    screenrint(50,100,"All enemies are dead",red)
    end

    if Enemy[currentEnemy].health == 0 and currentEnemy <= 4 then
    currentEnemy = currentEnemy + 1
    end
    if pad:cross() and oldpad:cross() ~= pad:cross() and Enemy[currentEnemy].health > 0 then
    Enemy[currentEnemy].health = Enemy[currentEnemy].health - 5

    screen.waitVblankStart()
    screen.flip()
    oldpad = pad
    end

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

    cant work out how to put it in one of them code boxes... someone tell me how and i'll edit it ;)

    anyway the error is at line 24 which i made that area bold.. cant see the prob though.

    thx in advance.

  11. #7751
    QJ Gamer Green
    Points: 5.971, Level: 50
    Level completed: 11%, Points required for next Level: 179
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    640
    Points
    5.971
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von mraellis
    its weird, i am into and not into it... i keep doing what one of the other guys said about redoing it then leaving it then coming back. so even with completing all the evil mana tuts i don't know every done there to explain to people but if you was to make a simple project I'd probably understand a fair bit of the source. i need to buckle down and learn lua proper instead of toying with it.

    thanks to you making this post ( which i kinda thought omg post in the lua thread help you idiot at first to (( sorry :P )) ) now I'm gonna try actually learning proper

    p.s I've just hit tut 5 you was on ;)
    well I thought it would get less helps and it would be harder to track whether my question were answered in a thread which is over a hundred posts

    p.s. i'm on 10

  12. #7752
    Banned from QJ for LIFE
    Points: 10.957, Level: 69
    Level completed: 27%, Points required for next Level: 293
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    1.557
    Points
    10.957
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    i guess. i asked a question there just though... kinda got stuck slightly on number 6... cant see why though it looks fine.

  13. #7753
    QJ Gamer Blue
    Points: 4.369, Level: 42
    Level completed: 10%, Points required for next Level: 181
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    246
    Points
    4.369
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    Well, with the resize/flipping function, you can use it with the regular blit, you just need to set it up correctly. Take my example script from my previous post, if you edit it like this it will work:

    Code:
    img = Image.load("image.png")
    
    pad = Controls.read()
    screen:clear()
    
    screen:blit(100,100,img)
    
    Gu.start3d() 
    Gu.blit( 20,  20, img, 0.5, "H")
    Gu.blit(100,  10, img, 1.5, "HV")
    Gu.blit(300,  10, img, "V")
    Gu.end3d() 
    screen:flip()
    
    screen:blit(200,200,img)
    
    while not pad:start() do
    	pad = Controls.read()
    end
    See, as long as you put the regular screen:blit outside the Gu start and end statements, you can mix the screen:blit and gu.blit without breaking the code. In fact, if you put the start and end statements inside the gu.blit function itself then you don't have to worry about it. The only reason I didn't do that is because using Gu.start3d() and Gu.end3d() causes a very small delay. The delay isn't anything to worry about if you only use them once per program cycle, however if you put them in the Gu.Blit function itself and then every call to Gu.Blit would then add to the delay.

  14. #7754
    QJ Gamer Green
    Points: 5.971, Level: 50
    Level completed: 11%, Points required for next Level: 179
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    640
    Points
    5.971
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von mraellis
    i guess. i asked a question there just though... kinda got stuck slightly on number 6... cant see why though it looks fine.
    want me to help lol i got through that perfectly here is my source code
    Code:
    System.usbDiskModeActivate()
    white = Color.new(255, 255, 255)
    
    currentEnemy = 1
    
    oldpad = Controls.read()
    
    Enemy = { }
    Enemy[1] = { type = "gargoyle", health = 100 }
    Enemy[2] = { type = "vampire", health = 100 }
    Enemy[3] = { type = "goomba", health = 100 }
    Enemy[4] = { type = "ghost", health = 100 }
    Enemy[5] = { type = "zombie", health = 100 }
    
    Player = { }
    Player[1] = { weapon = "sword", health = 100 }
    Player[2] = { weapon = "knife", health = 100 }
    
    while true do
    pad = Controls.read()
    
    screen:clear()
    
    screen:print(5,10,"Player 1 Health: " .. Player[1].health,white)
    screen:print(5,20,"Player 1 Weapon: " .. Player[1].weapon,white)
    
    screen:print(250,10,"Enemy Health: " .. Enemy[currentEnemy].health,white)
    screen:print(250,20,"Enemy Type: " .. Enemy[currentEnemy].type,white)
    
    if currentEnemy == 5 and Enemy[currentEnemy].health == 0 then
    screen:print(50,100,"All enemies are dead",white)
    end
    
    	if Enemy[currentEnemy].health == 0 and currentEnemy <= 4 then
    	currentEnemy = currentEnemy + 1
    	end
    
    	if pad:cross() and oldpad:cross() ~= pad:cross() and Enemy[currentEnemy].health > 0 then
    	Enemy[currentEnemy].health = Enemy[currentEnemy].health - 5
    	end
    
    screen.waitVblankStart()
    screen.flip()
    oldpad = pad
    end
    p.s. i'm on 12 now! Also, have you created any lua applications? if you have, did they make the front page or dl.qj.net? Even if they didn't, I bet they were something useful or a demo of some sort unless you didn't make any yet.

    p.p.s: I will be using this thread for help again when I start to develop the Bat and mouse port/clone, and I am calling it RODM, or Run or Die, Mouse, since it isn't always a mouse that is chasing you, and I might add a cat for the fun of it lol

    HELP! i AM STUCK ON PONG! I CAN'T GET THE BALL TO MOVE!
    Geändert von Gam3freQ (07-19-2007 um 09:33 PM Uhr)

  15. #7755
    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

    Zitat Zitat von mraellis
    Ok I've been doing the evil mana tutorials. I've kinda hit a snag at number 6 and cant work out why..

    here's the code.

    -- ******* Tables ********

    oldpad = Controls.read()

    green = Color.new(0,255,0)
    red = Color.new (255,0,0)
    blue = Color.new (0,0,255)

    currentEnemy = 1

    Enemy = { }
    Enemy[1] = { type = "gargoyle", health = 100 }
    Enemy[2] = { type = "vampire", health = 100 }
    Enemy[3] = { type = "goomba", health = 100 }
    Enemy[4] = { type = "ghost", health = 100 }
    Enemy[5] = { type = "zombie", health = 100 }

    Player = { }
    Player[1] = { weapon = "sword", health = 100 }
    Player[2] = { weapon = "knife", health = 100 }

    -- *****Main Loop******

    while true do

    pad = Controls.read()
    screen:clear()

    screenrint(5,10,"Player 1 Health: " .. Player[1].health,red)
    screenrint(5,20,"Player 1 Weapon: " .. Player[1].weapon,blue)
    screenrint(250,10,"Enemy Health: " .. Enemy[currentEnemy].health,green)
    screenrint(250,20,"Enemy Type: " .. Enemy[currentEnemy].type,green)

    if currentEnemy == 5 and Enemy[currentEnemy].health == 0 then
    screenrint(50,100,"All enemies are dead",red)
    end

    if Enemy[currentEnemy].health == 0 and currentEnemy <= 4 then
    currentEnemy = currentEnemy + 1
    end
    if pad:cross() and oldpad:cross() ~= pad:cross() and Enemy[currentEnemy].health > 0 then
    Enemy[currentEnemy].health = Enemy[currentEnemy].health - 5

    screen.waitVblankStart()
    screen.flip()
    oldpad = pad
    end

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

    cant work out how to put it in one of them code boxes... someone tell me how and i'll edit it ;)

    anyway the error is at line 24 which i made that area bold.. cant see the prob though.

    thx in advance.
    This is why you should format your code ;)
    Code:
    -- ******* Tables ********
    oldpad = Controls.read()
    green = Color.new(0,255,0)
    red = Color.new (255,0,0)
    blue = Color.new (0,0,255)
    currentEnemy = 1
    Enemy = { }
    Enemy[1] = { type = "gargoyle", health = 100 }
    Enemy[2] = { type = "vampire", health = 100 }
    Enemy[3] = { type = "goomba", health = 100 }
    Enemy[4] = { type = "ghost", health = 100 }
    Enemy[5] = { type = "zombie", health = 100 }
    Player = { }
    Player[1] = { weapon = "sword", health = 100 }
    Player[2] = { weapon = "knife", health = 100 }
    -- *****Main Loop****** 
    while true do
        pad = Controls.read()
        screen:clear()
        
        screenrint(5,10,"Player 1 Health: " .. Player[1].health,red)
        screenrint(5,20,"Player 1 Weapon: " .. Player[1].weapon,blue)
        screenrint(250,10,"Enem y Health: " .. Enemy[currentEnemy].health,green)
        screenrint(250,20,"Enem y Type: " .. Enemy[currentEnemy].type,green)
        
        if currentEnemy == 5 and Enemy[currentEnemy].health == 0 then
            screenrint(50,100,"All enemies are dead",red)
        end
        
        if Enemy[currentEnemy].health == 0 and currentEnemy <= 4 then
            currentEnemy = currentEnemy + 1
        end
        if pad:cross() and oldpad:cross() ~= pad:cross() and Enemy[currentEnemy].health > 0 then
            Enemy[currentEnemy].health = Enemy[currentEnemy].health - 5
        end
        
        screen.waitVblankStart()
        screen.flip()
        oldpad = pad
    end
    Look at line 42 right there and compare.

    Also, this goes to everyone sorta, I need a GFX artiist very soon. You'll be given access to builds and input shall be taken from you (bugs, improvments, etc.). I only need menu GFX, pause menu GFX and a few misc. things (logo, muzzle flash, smoke particle, fire particle ,etc.). All the main game graphics are 3d models, textured/animatedl, so I don't need help there. If you are interested PM me. Note, you must have ite alot of spare time I suppose. You'll be given atleast 5 days to do the work given to you. Also, if anyone knows where this sort of reqest should go, please tell me.

    ...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


  16. #7756
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    i smell something sweet coming from sg=-)
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  17. #7757
    Banned from QJ for LIFE
    Points: 10.957, Level: 69
    Level completed: 27%, Points required for next Level: 293
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    1.557
    Points
    10.957
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    thanks a lot AdjutantReflex.

    i missed a end at the end :P

    i'll try to make the code look neater in future so its not so messy and easyier to find faults like that.

  18. #7758
    Banned from QJ for LIFE
    Points: 10.957, Level: 69
    Level completed: 27%, Points required for next Level: 293
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    1.557
    Points
    10.957
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    i'm on 7 now thanks to AdjutantReflex

    thx for the source but i'd already checked other thread first, i missed that second to last end before the screen flip

    as for the p.s well i kinda created a program months ago. never released it though and dunno where it is now on the number of hd's i have with my rubbish on. it was very basic but it worked it was a insult device where if you press x it insulted you by reading a random insult from a .txt file. and if you pressed o then it said something nice about you. i used it to get the psp to insult mates and then say nice stuff about me to make them think it liked me but not them LOL. wish i knew where it was i might release it for other people to play with.

    p.s i cant help you with pong "yet" ;) post your code up though for others or me if i can spot something simple you missed.

    p.p.s i'm gonna look into this game i'm sure you posted the link on a earlier page... if i like the look of it could we maybe work together?


    edit----

    okay I've just looked at it. seems rather simple. the AI isn't exactly up to much. its set to home in on where you are at all times and with each cheese you get its speed goes up by 1 and it basically freezes if you get a clock. that actually sounds mostly simple to code but with a little bit of challenge at the same time. only thing that shocked me was the blood when the mouse died :O anyway so it'd go something like;

    load colours, load cat/bat/mouse images, load your vars set up that the enemy basically follows you but if you get a clock it stops for 10 secs, you score a point with each cheese you get and then the cheese appears at random anywhere on screen ( now thats the bit that sounds a little challenging cus i don't know about making stuff appear at random places. ) then finish it off and thats the basic game enless you add more stuff to improve it. quick fun game which is rather easy to code. i'd like to help if possible? maybe a team effort? upto you. will check thread later.
    Geändert von Mraellis (07-20-2007 um 04:39 AM Uhr)

  19. #7759
    QJ Gamer Bronze
    Points: 8.665, Level: 62
    Level completed: 72%, Points required for next Level: 85
    Overall activity: 0%

    Registriert seit
    Mar 2007
    Beiträge
    758
    Points
    8.665
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    did you make the ballMovement() function?
    and if you did, did you make sure to put it in your main loop?

  20. #7760
    Developer and Tutor.
    Points: 8.736, Level: 62
    Level completed: 96%, Points required for next Level: 14
    Overall activity: 0%

    Registriert seit
    Jul 2007
    Ort
    Widnes, England
    Beiträge
    1.649
    Points
    8.736
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    to put your code in a code box type [CO.DE] at the beginning and [/CO.DE] at the end without the dot in the middle and this happens

    Code:
    this is in a code box
    the same for quote and other stuff aswell
    ------ FaT3oYCG -----
    AKA Craig, call me what you want to It's your preference.
    My Website: http://www.modern-gamer.co.uk/

    Currently working on:
    (0) MediaGrab
    (0) PGE Gears Of War - On hold (Very large project).
    (0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).

  21. #7761
    Banned from QJ for LIFE
    Points: 10.957, Level: 69
    Level completed: 27%, Points required for next Level: 293
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    1.557
    Points
    10.957
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    Code:
    Thx a lot :)

  22. #7762
    Banned from QJ for LIFE
    Points: 10.957, Level: 69
    Level completed: 27%, Points required for next Level: 293
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    1.557
    Points
    10.957
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    i got bored so made a list of stuff you'd need to make it.
    its not complete though.

    .wav

    chomping noise
    splatting noise
    Boom noise
    whacking noise
    squeaking noise
    heavy object falling noise
    gun shooting noise

    .png

    mouse looking 8 directions
    mouse splatting against screen facing you
    mouse splatted on ground with blood
    nuclear bomb
    cheese
    squashed mouse
    100 ton weight
    shotgun
    5 different backgrounds
    bat
    bat swinging
    crosshairs
    ashes of mouse
    explosion
    map border per bg

  23. #7763
    QJ Gamer Silver
    Points: 12.453, Level: 73
    Level completed: 1%, Points required for next Level: 397
    Overall activity: 80,0%

    Registriert seit
    Mar 2007
    Beiträge
    1.129
    Points
    12.453
    Level
    73
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Merick
    Well, with the resize/flipping function, you can use it with the regular blit, you just need to set it up correctly. Take my example script from my previous post, if you edit it like this it will work:

    Code:
    img = Image.load("image.png")
    
    pad = Controls.read()
    screen:clear()
    
    screen:blit(100,100,img)
    
    Gu.start3d() 
    Gu.blit( 20,  20, img, 0.5, "H")
    Gu.blit(100,  10, img, 1.5, "HV")
    Gu.blit(300,  10, img, "V")
    Gu.end3d() 
    screen:flip()
    
    screen:blit(200,200,img)
    
    while not pad:start() do
    	pad = Controls.read()
    end
    See, as long as you put the regular screen:blit outside the Gu start and end statements, you can mix the screen:blit and gu.blit without breaking the code. In fact, if you put the start and end statements inside the gu.blit function itself then you don't have to worry about it. The only reason I didn't do that is because using Gu.start3d() and Gu.end3d() causes a very small delay. The delay isn't anything to worry about if you only use them once per program cycle, however if you put them in the Gu.Blit function itself and then every call to Gu.Blit would then add to the delay.
    whoa very nice function, i could never figure out gu. i have a question though, won't this is only accept certain sizes?

  24. #7764
    QJ Gamer Blue
    Points: 4.369, Level: 42
    Level completed: 10%, Points required for next Level: 181
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    246
    Points
    4.369
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    take a look at the code for the function:

    Code:
    function Gu.blit(x, y, image, scale, flip)
    	
    	if not scale or type(scale) == "string" then 
    		flip = scale
    		scale = 1
    	end
    	
    	if flip then
    		if flip == "H" then
    			x_start = image:width()
    			y_start = 0
    			x_end  = 0
    			y_end = image:height()
    		elseif  flip == "V" then
    			x_start = 0
    			y_start = image:height()
    			x_end  = image:width()
    			y_end = 0
    		elseif flip == "HV" then
    			x_start = image:width()
    			y_start = image:height()
    			x_end = 0
    			y_end = 0
    		end
    	else
    		x_start = 0
    		y_start = 0
    		x_end = image:width()
    		y_end = image:height()
    	end
    	
    	width = (image:width()*scale)+x
    	height = (image:height()*scale)+y
    	temp = {
    	{x_start, y_start, x, y, 0},
    	{x_end, y_end, width, height, 0}
    	}
    	Gu.enable(Gu.TEXTURE_2D)
    	Gu.texImage(image)
    	Gum.drawArray(Gu.SPRITES, Gu.TEXTURE_32BITF+Gu.VERTEX_32BITF+Gu.TRANSFORM_2D, temp)
    end
    "temp" is the model table used by the Gu, and the x_start, y_start, x_end, y_end variables in the table represent the 4 corners of the image you are using, and which corner goes into which variable is determined by the "flip" argument. If you were to use standard u,v coords for these (I.E., numbers between 0 and 1) then you would get messed up graphics if you were using an image with some odd size, however here I'm using the actual image width and height which should let you use any size image without problem.

    Also in the "temp" table there are two variables, "width" and "height" which are calculated by this formula:

    width = (image:width()*scale)+x
    height = (image:height()*scale)+y

    This changes the size that the image is drawn at by multiplying the image height and width by the scale argument, so if you have a 50x100 image and use 1.5 for the scale, then the image will be drawn at 75x150, or with a scale of 0.2 it will be drawn at 10x20.

    Basically, what I'm saying is that with this there's no limits on the size of the images you can use (as long as it's at a size that lua player can normally load of coarse), or the size that you can draw them at.

  25. #7765
    QJ Gamer Silver
    Points: 12.453, Level: 73
    Level completed: 1%, Points required for next Level: 397
    Overall activity: 80,0%

    Registriert seit
    Mar 2007
    Beiträge
    1.129
    Points
    12.453
    Level
    73
    Downloads
    0
    Uploads
    0

    Standard

    wow, nice work!

    edit:
    oh wait one more question, the x and y coordinates are in real pixels right? so if i wanted it to be flush in the top left i would have to use -240,136 correct? and is there anyway to put this back into an image var, say blit from the screen to an image?

  26. #7766
    QJ Gamer Blue
    Points: 4.369, Level: 42
    Level completed: 10%, Points required for next Level: 181
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    246
    Points
    4.369
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    With the Gu, the function Gum.translate changes the coordinate system from 2d to 3d, but because Gu.blit doesn't call Gum.translate it uses the same 2d coordinate system as the regular blit.

    So, to put an image at the top left, use 0,0.

    As for putting it into an image, for some reason using img:blit(0,0, screen) does not capture anything that was drawn with the Gu.

    However, although I haven't tried it, I believe that if you use screen:save("screen.png") to save a screenshot to an image file, then you can load that image and use it like you would any other

    And actually, this isn't entirely my own code. The core of this was based on something Cools posted on the evilmana board, I just figured out how to use it with odd-sized image dimensions and added in the options for flipping the images.

  27. #7767
    QJ Gamer Green
    Points: 5.971, Level: 50
    Level completed: 11%, Points required for next Level: 179
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    640
    Points
    5.971
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von mraellis
    i got bored so made a list of stuff you'd need to make it.
    its not complete though.

    .wav

    chomping noise
    splatting noise
    Boom noise
    whacking noise
    squeaking noise
    heavy object falling noise
    gun shooting noise

    .png

    mouse looking 8 directions
    mouse splatting against screen facing you
    mouse splatted on ground with blood
    nuclear bomb
    cheese
    squashed mouse
    100 ton weight
    shotgun
    5 different backgrounds
    bat
    bat swinging
    crosshairs
    ashes of mouse
    explosion
    map border per bg
    yes That makes sense but I can't finish the pong tutorial because The ball doesn't move, and I havn't worked on it for days, so you want to just make a LUA PROGRAMMING TEAM for us 2 and start on RODM?

  28. #7768
    QJ Gamer Bronze
    Points: 5.934, Level: 49
    Level completed: 92%, Points required for next Level: 16
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Beiträge
    654
    Points
    5.934
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Hey were are u two getting ur lua tutorials? I think ima start learning lua too :) Well i already started before.. just stopped cus there was only 2 tutorials on psp-programming

  29. #7769
    QJ Gamer Blue
    Points: 4.509, Level: 42
    Level completed: 80%, Points required for next Level: 41
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    United Kingdom
    Beiträge
    63
    Points
    4.509
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    Check out Evilmana

  30. #7770
    Banned from QJ for LIFE
    Points: 10.957, Level: 69
    Level completed: 27%, Points required for next Level: 293
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    1.557
    Points
    10.957
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    evilmana.com thats where we're learning.

    gam3freq continued into pm.
    -= Double Post =-
    just a update to you guys we've teamed up and started on the project and we're gonna be silent now for a bit :)
    Geändert von Mraellis (07-22-2007 um 03:00 PM Uhr) Grund: Automerged Doublepost


 

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 09:00 PM Uhr.

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