![]() |
|
|
|
#1
|
|||
|
|||
|
Hey guy's trying PGE for the first time an creating a mini game. I was wondering if this is how you display an image for a few seconds then it goes to the game like a splash screen. I have attempted but no it's wrong I know it's wrong but here's the source code
Code:
white = pge.gfx.createcolor(255, 255, 255)
yellow = pge.gfx.createcolor(255, 255, 0)
bg = pge.texture.load("Start.png",PGE_RAM,true)
verdana16 = pge.font.load("verdana.ttf", 16, PGE_RAM)
if not bg then
error("Failed to load texture.")
end
if not verdana16 then
error("Error failed to load font.")
end
while pge.running() do
pge.controls.update()
pge.gfx.clearscreen()
pge.gfx.startdrawing()
bg:activate()
bg:draw(0,0)
verdana16:activate()
pge.gfx.enddrawing()
pge.gfx.swapbuffers(10)
end
|
|
#2
|
||||
|
||||
|
where is your few seconds delay? im guessing that would just continuously draw the bg on the screen.
think of the concept of what your doing. draw bg wait clear screen draw something else. it shouldn't be in a loop unless you have somekind of states system to skip it when the time is right. i just wouldn't put drawing a splash screen in a loop tho.
__________________
http://levoneprojects.net23.net/
![]() ++rep me if i helped you please. Ahh, shit. Stupidity is on the rise again. went legit Oct. 31, 09' piracy is wrong, please don't do it. |
|
#3
|
|||
|
|||
|
Quote:
|
|
#4
|
||||
|
||||
|
i don't use lua...
but the concept and implementation is the same regardless. well, the methods called have different names.. look up what you need then do it. what you have does draw on the screen correct? if so then.. Code:
white = pge.gfx.createcolor(255, 255, 255)
yellow = pge.gfx.createcolor(255, 255, 0)
bg = pge.texture.load("Start.png",PGE_RAM,true)
verdana16 = pge.font.load("verdana.ttf", 16, PGE_RAM)
if not bg then
error("Failed to load texture.")
end
if not verdana16 then
error("Error failed to load font.")
end
while pge.running() do <<remove this.
pge.controls.update()
pge.gfx.clearscreen()
pge.gfx.startdrawing()
bg:activate()
bg:draw(0,0)
verdana16:activate()
pge.gfx.enddrawing()
pge.gfx.swapbuffers(10)
<<insert a wait here.
<<insert clear screen method.
end<<remove this.
__________________
http://levoneprojects.net23.net/
![]() ++rep me if i helped you please. Ahh, shit. Stupidity is on the rise again. went legit Oct. 31, 09' piracy is wrong, please don't do it. Last edited by pspjoke; 11-01-2009 at 03:48 PM. |
|
#5
|
|||
|
|||
|
Yo Kervin ... what's up??
Quote:
It doesn't matter , still , the logic is pretty simple... Let me guess , you still haven't learned the basics ... right?.................... Spoiler: Last edited by Brick; 11-02-2009 at 12:17 AM. |
|
#6
|
|||
|
|||
|
Yo brick what up I haven't learnt that yet but thanks could you maybe explain the code a little
|
|
#7
|
|||
|
|||
|
OK got it but it keep looping and I took of the pge.running() do off and now it wont work so here's the working code
Code:
--COLORS
white = pge.gfx.createcolor(255, 255, 255)
yellow = pge.gfx.createcolor(255, 255, 0)
--PICTURES
bg = pge.texture.load("./pictures/start.png")
if not bg then
error("Failed to load texture.")
end
--FONTS
verdana16 = pge.font.load("verdana.ttf", 16, PGE_RAM)
if not verdana16 then
error("Error failed to load font.")
end
while pge.running() do
pge.controls.update()
pge.gfx.startdrawing()
pge.gfx.clearscreen()
bg:activate()
bg:draw(0,0)
pge.gfx.swapbuffers()
pge.delay(3000000)
end
|
|
#8
|
||||
|
||||
|
its keeps looping cause its in a loop....
thought that would be an obvious thing..
__________________
http://levoneprojects.net23.net/
![]() ++rep me if i helped you please. Ahh, shit. Stupidity is on the rise again. went legit Oct. 31, 09' piracy is wrong, please don't do it. |
|
#9
|
|||
|
|||
|
it is obvious but when I take out the while pge.running() do it messes up the code it's so weird
|
|
#10
|
||||
|
||||
|
pge.running() may do something to start off the pge engine.
call it by itself out of the loop and see what happens.
__________________
http://levoneprojects.net23.net/
![]() ++rep me if i helped you please. Ahh, shit. Stupidity is on the rise again. went legit Oct. 31, 09' piracy is wrong, please don't do it. |
![]() |
|
|
|||
|
|||
|
|
| Thread Tools | |
| Display Modes | |
|
|