Animating a GUI to Pop up from the bottom of the screen HELP!

Started by SinSin, Wed 10/02/2010 22:08:59

Previous topic - Next topic

monkey0506

An alternative to the grouping I showed above would be simply to change the else clause to re-evaluate the mouse's y co-ordinate in addition to evaluating the GUI's y co-ordinate. The reason that I would say this is wrong is because it's a less efficient way of programming than simply splitting the if statement as I did.

Hope there's no offense taken tzachs. I'm just a bit of a Nazi when it comes to scripting I guess. Of course I was born in Germany... ::)

Although actually I try to be lenient when it comes to things like programming style, matters like consistency and efficiency tend to grind my gears a bit. Like the fact that there's loads more overhead in using the Tween module for a simple GUI movement than just moving the GUI yourself...but I understand that it vastly simplifies things for those who aren't as skillful with scripting as myself, so it's a trade-off there. :P

tzachs

No offense taken :) , I actually used the same code myself for my GUI, I just posted from memory and didn't check myself...  

I actually prefer using the Tween Module though, because it makes experimenting easier regarding the timings, so actually I think it's less overhead then coding it yourself (if you are an experimenter)...
I also find that using a module is better in most cases because even something that looks simple can have caveats that you didn't think of and were probably handled in the module. This can save you precious time, which is more critical for me than efficiency for adventure games (obviously not the approach I would take for writing drivers or some real-time critical code)...

monkey0506

On my computer AGS games are real-time critical. :=

D3D Driver? Forget about it! Pixel shader 2.0? Forget about it! FPS over 30 at a resolution over 640x400? Forget about it! ::)

SinSin

Quote from: monkey_05_06 on Fri 12/02/2010 19:34:46
Code: ags
if (mouse.y >= ypos) {
  if (gTask.Y != ypos) gTask.TweenPosition(1.0, gTask.X, ypos, eEaseInTween, eBlockTween);
}
else if (gTask.Y < (System.ViewportHeight - 1)) gTask.TweenPosition(1.0, gTask.X, System.ViewportHeight - 1, eEaseInTween,  eBlockTween);


So am i using this example or the tween module one...  I'm confused

I have the tween module imported already and now i have this as my code  .. what should i change  and indeed where  ???
(Regarding the gui going up and down continuosly??)

Code: ags

#sectionstart repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE
function repeatedly_execute() 
{
    int ypos = (System.ViewportHeight - gTask.Height);
    if (mouse.y >= ypos && gTask.Y != ypos) {
          //GUI scrolls up
          gTask.TweenPosition(1.0, gTask.X, ypos, eEaseInTween, eBlockTween);
    }
    else if (gTask.Y < System.ViewportHeight - 1) {
         //GUI scrolls down
         gTask.TweenPosition(1.0, gTask.X, System.ViewportHeight - 1, eEaseInTween,  eBlockTween);
    }
}
 
#sectionend repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE
Currently working on a project!

tzachs

Code: ags

#sectionstart repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE
function repeatedly_execute() 
{
    int ypos = (System.ViewportHeight - gTask.Height);
    if (mouse.y >= ypos) {
       if (gTask.Y != ypos) {      
          //GUI scrolls up
          gTask.TweenPosition(1.0, gTask.X, ypos, eEaseInTween, eBlockTween);
       }
    }
    else if (gTask.Y < System.ViewportHeight - 1) {
         //GUI scrolls down
         gTask.TweenPosition(1.0, gTask.X, System.ViewportHeight - 1, eEaseInTween,  eBlockTween);
    }
}
 
#sectionend repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE

SinSin

Good stuff fella  ;D
but one thing remains, when a button is pressed on the Gui, The Gui dissapears completely then when the mouse moves above the ypos the Gui then returns and lowers, Also the character wont go anywhere or interact/look 
Currently working on a project!

SinSin

Ok So Iv stopped being a COMPLETE NOOB and realised that what I was doing was if fact Pop up modal (which automatically pauses the game) So I changed its settings to Normal initially on, Now the GUI works fine it is great I thank you for all your help this far  :)

The only problem I have now is that after the GUI has tweened off my character will not move, look_at or anything at all and a Gui Label which is on another GUI wont show the names of hotspots even tho its text is @OVERHOTSPOT@   .   There are walkable areas there and yes he is stood well within the area too,
I think that the tween is pausing the game somehow   Any Ideas on a fix.

Any help will be much appreciated
Currently working on a project!

Dualnames

Tween isn't pausing the game. Is the cursor in wait cursor when you can't move or walk ecc?

To make sure have something like this on a repeatedly_execute..

Code: ags

if (IsGamePaused()==1) UnPauseGame();


But something else is the issue. Something to do with the GUI, I think there's a BIG clickable GUI all over the screen causing all this. And you probably have made something wrong, without noticing it. But that would only be the problem if it was totally transparent.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

SinSin

Quote from: Dualnames on Mon 15/02/2010 00:26:38
Tween isn't pausing the game. Is the cursor in wait cursor when you can't move or walk ecc?
Yeah the wait cursor is active when the GUI is not visible, However when the GUI pops up the Wait cursor changes to the active cursor

Quote
To make sure have something like this on a repeatedly_execute..

Code: ags

if (IsGamePaused()==1) UnPauseGame();


But something else is the issue. Something to do with the GUI, I think there's a BIG clickable GUI all over the screen causing all this. And you probably have made something wrong, without noticing it. But that would only be the problem if it was totally transparent.

There is only one other GUI and its always visible its only a bar at the top of the screen with a label inside it
Currently working on a project!

Dualnames

Quote from: Sinsin on Mon 15/02/2010 00:39:53
Quote from: Dualnames on Mon 15/02/2010 00:26:38
Tween isn't pausing the game. Is the cursor in wait cursor when you can't move or walk ecc?
Yeah the wait cursor is active when the GUI is not visible, However when the GUI pops up the Wait cursor changes to the active cursor

Quote
To make sure have something like this on a repeatedly_execute..

Code: ags

if (IsGamePaused()==1) UnPauseGame();


But something else is the issue. Something to do with the GUI, I think there's a BIG clickable GUI all over the screen causing all this. And you probably have made something wrong, without noticing it. But that would only be the problem if it was totally transparent.

There is only one other GUI and its always visible its only a bar at the top of the screen with a label inside it

Your tweening is neverending from what I understand. The tween command doesn't stop. put a return after each tween command for me.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

SinSin

Quote

Your tweening is neverending from what I understand. The tween command doesn't stop. put a return after each tween command for me.

Just for the record define return please,
Currently working on a project!

tzachs

Hmmm, I used the exact same code and had no problems.
I don't see how adding a "return" statement after the tween will help, maybe you have something else going on there (maybe there's an invisible clickable gui blocking the screen or something of that sort)?
If you want to post a sample with the problem, I can try and solve it...

SinSin

Quote from: tzachs on Mon 15/02/2010 12:03:34
Hmmm, I used the exact same code and had no problems.
I don't see how adding a "return" statement after the tween will help, maybe you have something else going on there (maybe there's an invisible clickable gui blocking the screen or something of that sort)?
If you want to post a sample with the problem, I can try and solve it...

Just at work at the mo but when I get home I will do, Do you just wanna see the repeatedly execute section or do you need more?   Again thanks
Currently working on a project!

tzachs

I honestly don't know, it depends where the problem is...
The ideal thing is for you to make a sample that illustrates the problem, and then upload the project (it doesn't have to be your game if that bothers you, just a sample) so I can download it, open with ags and debug to see the problem.

SinSin

        This        is the whole file I have been working with   
                       Please note it the wait cursor is slightly darker than the usual cursor


Thanks
Currently working on a project!

tzachs

Ahh, you didn't copy my code correctly before...
Change
Code: ags

else if (gTask.Y < System.ViewportHeight) {

to
Code: ags

else if (gTask.Y < System.ViewportHeight - 1) {

SinSin

Quote from: tzachs on Mon 15/02/2010 20:41:47
Ahh, you didn't copy my code correctly before...
Change
Code: ags

else if (gTask.Y < System.ViewportHeight) {

to
Code: ags

else if (gTask.Y < System.ViewportHeight - 1) {


Yay fixed it thanks dude   I did have the code copied exactly at one point as I recall but I must have changed it   
when i was tinkering lol 

Thanks for all your hard work     now go have a beer     and i will now shut up ...For now ...

Currently working on a project!

SMF spam blocked by CleanTalk