view

Non-platform specific questions.

view

Postby praaab » Wed Feb 22, 2012 11:27 pm

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).
praaab
 
Posts: 82
Joined: Sat Jun 18, 2011 2:14 pm
Score: 1 Give a positive score

Re: view

Postby SuperSonic » Thu Feb 23, 2012 12:24 am

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
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: view

Postby skydereign » Thu Feb 23, 2012 12:24 am

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;
}
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: view

Postby praaab » Thu Feb 23, 2012 12:48 am

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?
praaab
 
Posts: 82
Joined: Sat Jun 18, 2011 2:14 pm
Score: 1 Give a positive score

Re: view

Postby skydereign » Thu Feb 23, 2012 12:58 am

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: view

Postby praaab » Thu Feb 23, 2012 1:08 am

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?
praaab
 
Posts: 82
Joined: Sat Jun 18, 2011 2:14 pm
Score: 1 Give a positive score

Re: view

Postby skydereign » Thu Feb 23, 2012 1:12 am

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;
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: view

Postby praaab » Thu Feb 23, 2012 1:19 am

thank you so much for both of your help, +1 for both of you
praaab
 
Posts: 82
Joined: Sat Jun 18, 2011 2:14 pm
Score: 1 Give a positive score

Re: view

Postby SuperSonic » Thu Feb 23, 2012 9:23 pm

No problem. And thanks for the point ^^
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest