23.03.2010, 19:35
Hi ,
ich habe in der letzen zeit ein kleines spielchen programmier(natürlich für psp ) . Es funkt alles , bist auf da hab ich so ein berg im background und da schwimmt der halt nich gegen sonden vobei aber das will ich net ,wie mach ich also das er das stehn bleibt ??? Hier mein code :
ich habe in der letzen zeit ein kleines spielchen programmier(natürlich für psp ) . Es funkt alles , bist auf da hab ich so ein berg im background und da schwimmt der halt nich gegen sonden vobei aber das will ich net ,wie mach ich also das er das stehn bleibt ??? Hier mein code :
Code:
red = Color.new(255, 0, 0)
white = Color.new(0, 0, 0)
black = Color.new(255, 255, 255)
gamestate = "intro"
--------------------------------weapon
fish1 = Image.load( "weapons/fish1.png" )
fish2 = Image.load( "weapons/fish2.png" )
weapon = {}
weapon = { x = 2, y = 50, speed = 4, score = 0, img = nil, smashpic = nil}
fake = Image.createEmpty (480,272)
-----------------------------function
function smashtrue()
smash = true
end
----------------------------------------------------Backgrounds
backgroundsmenu = Image.load("backgroundsmenu.png")
default = Image.load("backgrounds/default.jpg")
untergrund = Image.load("backgrounds/unter.jpg")
title = Image.load("title.png")
background = default
pausemenu = Image.load("pausemenu.png")
Resolution = { width = 480, height = 272 }
gamestate = nil
-----------------------------------------gamstate
if gamestate == "intro" then
title = Image.load("title.png")
end
screen:clear()
screen:blit(0, 0, title, false)
screen:print(200, 170, "Loading", red)
screen:print(440, 2, "v3.1", red)
screen.flip()
screen.waitVblankStart(20)
--------------------------------------------------controls
function moveplayer()
anaX=pad:analogX()
anaY=pad:analogY()
if pad:up() and weapon.y > 0 then
weapon.y = weapon.y - weapon.speed
end
if pad:down() and weapon.y < ( Resolution.height) then
weapon.y = weapon.y + weapon.speed
end
if pad:left() and weapon.x > 0 then
weapon.x = weapon.x - weapon.speed
end
if pad:right() and weapon.x < ( 480) then
weapon.x = weapon.x + weapon.speed
end
end
function controlplay()
if pad:start() then
gamestate = "paused"
end
if pad:note() then
screen:save("screenshot.png")
end
if pad:cross() then
smashtrue()
end
if pad:select() then
gamestate = "picselect"
end
end
screen:clear()
screen:blit(0, 0, title, false)
screen.flip()
screen.waitVblankStart(180)
weapon.img = fish1
menustatus = 1
gamestate = "play"
while true do
screen:clear()
pad = Controls.read()
-------------------------------------------while loop
if smash == true then
if weapon.img == fish1 then
weapon.img = fish2
weapon.smashpic = fish2
fake:blit(weapon.x, weapon.y, weapon.smashpic)
else if weapon.img == fish2 then
weapon.img = fish1
end
smash = false
end
end
if gamestate == "play" then
screen:blit(0,0,background)
screen:blit(0,0,fake)
screen:blit (weapon.x,weapon.y,weapon.img)
moveplayer()
controlplay()
end
---------------------------------Pause
if gamestate == "paused" then
screen:blit(0,0,pausemenu)
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, white, white}
color[menustatus]=red
screen:print(50, 50, "Fisch", color[1])
if menustatus == 1 then
if pad:cross() then
weapon.img = fisch
gamestate = "play"
end
end
if menustatus <= 0 then
menustatus = 5
end
if menustatus >= 6 then
menustatus = 1
end
end
---------------------------------------Backrounds
if gamestate == "picselect" then
screen:blit(0,0,backgroundsmenu)
if pad:circle() then
gamestate = "play"
end
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, white}
color[menustatus]=red
screen:print(50, 50, "Default", color[1])
screen:print(50, 70,"untergrund",color[1])
if menustatus == 1 then
if pad:cross() then
background = default
fake:clear()
gamestate = "play"
end
end
if munustatus == 2 then
if pad:cross() then
background = untergrund
fake:clear()
gamestate = "play"
end
end
if menustatus <= 0 then
menustatus = 2
end
if menustatus >= 3 then
menustatus = 1
end
end
screen.waitVblankStart()
screen.flip()
end
MFG Robbi