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 

how do you change screens

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



Joined: 19 Oct 2005
Posts: 61

PostPosted: Wed Oct 19, 2005 7:05 am    Post subject: how do you change screens Reply with quote

how do you change screens like if you were making a zelda rip0-off (which im not) how do you change the screen from one room to the next?
like if you were to walk through the door, how do you load the next room?
Back to top
View user's profile Send private message
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Wed Oct 19, 2005 7:36 am    Post subject: Reply with quote

Use blit function to change rooms. Each call will overwrite old image with a new one.

If not much help, please clarify your need.
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
link



Joined: 19 Oct 2005
Posts: 61

PostPosted: Wed Oct 19, 2005 7:50 am    Post subject: Reply with quote

for an example in the tutorial they made a pac-man type of a game. how would you change screens in that game? I am a noob.....sorry.
Back to top
View user's profile Send private message
haust



Joined: 01 Oct 2005
Posts: 25
Location: France

PostPosted: Wed Oct 19, 2005 10:19 am    Post subject: Reply with quote

Well, one technic would be to have one offscreen image for each room. Now when your character is in room one just blit the first image on screen.
If you want to go to room two then slide/scroll both images, say from right to left. When the slide effect ends room one is off screen (no need to blit it) and room two becomes your new current room....

hope it helps :)
Back to top
View user's profile Send private message
link



Joined: 19 Oct 2005
Posts: 61

PostPosted: Wed Oct 19, 2005 12:15 pm    Post subject: Reply with quote

incredibly sorry, but how do do the side scroll or blit the image? PLEASE can you show me in the same game code as the tutorial listed on this web site so i can have some point of reference?
Back to top
View user's profile Send private message
haust



Joined: 01 Oct 2005
Posts: 25
Location: France

PostPosted: Wed Oct 19, 2005 2:27 pm    Post subject: Reply with quote

Code:
function main()
   local Rooms = {};
   local SlideX = 0;
   local SlideXSpeed = -1;

   Rooms[1] = Image.load("Room1.png");   -- 480x272
   Rooms[2] = Image.load("Room2.png");   -- 480x272

   while (false == Controls.read():start()) do
      SlideX = SlideX + SlideXSpeed;

      if (((-1 == SlideXSpeed) and (-480 == SlideX))
         or ((1 == SlideXSpeed) and (480 == SlideX))) then
         SlideXSpeed = -SlideXSpeed;
      end

      screen:clear();

      screen:blit(SlideX, 0, Rooms[1], 0, 0, 480, 272, false);
      screen:blit(SlideX + 480, 0, Rooms[2], 0, 0, 480, 272, false);

      screen.waitVblankStart()
      screen.flip()
   end
end

main();

The code provided above is very basic but it should give you an idea of the slide process.
First, two images are loaded, one for room one and the second for room two. Then, until start is pressed, both images are scrolled from rigth to left then from left to right.
Again, the code is very basic and a better blit strategy should/must be used. Now it's up to you to test and tweak this piece of code to better understand how it works :)
Back to top
View user's profile Send private message
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