forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

simple animation

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
paulieweb



Joined: 03 Nov 2005
Posts: 8
Location: PSU

PostPosted: Sat Nov 05, 2005 1:25 am    Post subject: simple animation Reply with quote

sorry to ask a rudimentary question, but i am relatively new to graphics

if i wanted to fill a cylinder type object up one line of pixels at a time:

_
| |
| |
| |
| |
_

(imagine each row is 4 pixels wide or something)
what is the best way to do this?

just make a for loop to drawline one at a time?
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
JoshDB



Joined: 05 Oct 2005
Posts: 87

PostPosted: Sat Nov 05, 2005 3:13 am    Post subject: Reply with quote

Here's something that might help. Sorry for the lack of proper explanation, but this code basically eases a menu up, so it goes faster then gradually slows down.

Code:
function ConceptCreate:CloseMenu()
   menuopenfull = false
   while menuposy < 273 do
      screen:clear()
      Concept:Render()
      Concept:Menu()
      screen.waitVblankStart(1)
      screen.flip()
      if menuposy < 273 then
         menuposy = menuposy + 1
         if menuposy < 260 then
            menuposy = menuposy + 2
            if menuposy < 250 then
               menuposy = menuposy + 3
               if menuposy < 240 then
                  menuposy = menuposy + 4
                  if menuposy < 230 then
                     menuposy = menuposy + 5
                     if menuposy < 220 then
                        menuposy = menuposy + 6
                     end
                  end
               end
            end
         end
      end
   end
   screen:clear()
   Concept:Render()
   menuposy = menuposy + 1
   screen.waitVblankStart(1)
   screen.flip()
end

function ConceptCreate:Render()
   Concept:RenderBaseImages()
   
   if menuopenfull == true then
      Concept:Menu()
   end
end

function ConceptCreate:RenderBaseImages()
   screen:blit(0,0,bg)
end

function ConceptCreate:Menu()
   screen:blit(menu_viewimagesposx,menuposy + 10,menu_viewimages)
   screen:blit(menu_viewmusicposx,menuposy + 20,menu_viewmusic)
   screen:blit(menu_viewprogramsposx,menuposy + 30,menu_viewprograms)
   screen:blit(menu_explorerposx,menuposy + 40,menu_explorer)
   screen:blit(menu_systeminfoposx,menuposy + 50,menu_systeminfo)
   screen:blit(menu_utilitiesposx,menuposy + 70,menu_utilities)
   screen:blit(menu_closeposx,menuposy + 90,menu_close)
end


From Concept - The Zulu Version PSP Shell

Might be a little complex for what you want, but yes, if you don't use this, you could use a drawline loop (;
Back to top
View user's profile Send private message Send e-mail AIM Address
chaos



Joined: 10 Apr 2005
Posts: 135

PostPosted: Sat Nov 05, 2005 3:37 am    Post subject: Reply with quote

simplest way would be a for loop with a 4 pixel wide rectangle (instead of 4 lines).
_________________
Chaosmachine Studios: High Quality Homebrew.
Back to top
View user's profile Send private message
paulieweb



Joined: 03 Nov 2005
Posts: 8
Location: PSU

PostPosted: Sat Nov 05, 2005 9:50 am    Post subject: Reply with quote

not really in relation to the preceeding, but i didn't feel like starting a new thread

if i have something like this:

Code:
         if marked[i][j] == 1 then
            strpiece = hor
         end

         if marked[i][j] == 2 then
            strpiece = vert
         end

         if marked[i][j] == 3 then
            strpiece = tjunct
         end

         if marked[i][j] == 4 then
            strpiece = ld
         end

         if marked[i][j] == 5 then
            strpiece = lu
         end

         if marked[i][j] == 6 then
            strpiece = rd
         end

         if marked[i][j] == 7 then
            strpiece = ru
         end
      end
   end

   screen:blit( 16 * (i - 1) + 236, 16 * (j - 1) + 28, strpiece)


it gives me an error because strpiece isn't a picture. how would i go about assigning the picture names (tjunct, ru, vert, etc) to a variable that lua would output when i do the bottom line, screen:blit ?
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
JoshDB



Joined: 05 Oct 2005
Posts: 87

PostPosted: Sat Nov 05, 2005 11:15 am    Post subject: Reply with quote

This is a problem I've hit. I fixed it with

Code:
if strpiece == ru then
       code
end
Back to top
View user's profile Send private message Send e-mail AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group