Page 1 of 1

view

PostPosted: Wed Feb 22, 2012 11:27 pm
by praaab
How do i make it so that when i have 0 lives the view moves to the highscore panel and for the view to move AFTER the player explodes (the explosion is a particle effect not an animation).

Re: view

PostPosted: Thu Feb 23, 2012 12:24 am
by SuperSonic
Put this in your view's draw actor event :wink:
Code: Select all
if(lives <= 0)
{
    x = HighScoreTable.x;
    y = HighScoreTabls.y;
}

You may have to change the code a bit but that should work for now :D

Re: view

PostPosted: Thu Feb 23, 2012 12:24 am
by skydereign
Pretty much the same as SuperSonic but assuming you are using the same particle effect what you want is for the last particle being destroyed to move the view. So, you can just check in the particle's destroy actor if it is the last particle (you'll also need to check if the player has no more lives).
Code: Select all
if(lives==0 && ActorCount(name)==1)
{
    view.x=1000; // some position
    view.y=1000;
}

Re: view

PostPosted: Thu Feb 23, 2012 12:48 am
by praaab
but when i use sonics version of the view it just moves the view to a random spot right away even though i still had 3 lifes and what actor do i put in the other method the particle?

Re: view

PostPosted: Thu Feb 23, 2012 12:58 am
by skydereign
When people provide code for you the first thing to do is understand what it is doing. You'll find that you can figure out why it doesn't work pretty easily. In your case you know exactly what it is doing wrong, and theoretically you can fix it because you understand what it isn't doing. We can't know everything in your games, so we tend to provide code that gets the general idea across, and you as the programmer can apply it to your game. In this case SuperSonic's code doesn't work to what you want because you want the view to move when the particles all disappear (and lives is 0). I happened to see your game so I knew what you needed and if you look it takes into account the problem you had.

The code belongs in the particles destroy actor event, and therefore will only trigger if the particle is being destroyed. But, we don't want it to move the view if there are still particles or if the player still has lives left. That's why it checks if lives is equal to 0, and if so continues to check if there is only one particle left. If that is the case it moves the view to some position (which would be where you want the view to move to display the hiscores). Another thing you'll need to do is set the view's xvelocity to 0.

Re: view

PostPosted: Thu Feb 23, 2012 1:08 am
by praaab
i understand now and i would like to thank both of you guys for the lesson today. I have one more thing i had my bullet go and it would increase speed as it kept going but i couldnt remember the code to it and my computer crashed on me what would make the velocity keep increasing?

Re: view

PostPosted: Thu Feb 23, 2012 1:12 am
by skydereign
If you want the bullet to increase speed, you just increase the xvelocity. The bullet should in its create actor event have some code that sets its xvelocity. In its draw event you can have it keep increasing xvelocity by a little bit.
Code: Select all
xvelocity+=0.5;

Re: view

PostPosted: Thu Feb 23, 2012 1:19 am
by praaab
thank you so much for both of your help, +1 for both of you

Re: view

PostPosted: Thu Feb 23, 2012 9:23 pm
by SuperSonic
No problem. And thanks for the point ^^