The Daily Click ::. Forums ::. Non-Klik Coding Help ::. View point Center, but not beyond window/play field edge
 

Post Reply  Post Oekaki 
 

Posted By Message

Kokocipher



Registered
  03/06/2008
Points
  439
6th June, 2008 at 08:17:01 -

I know how to use Viewpoint to center Player1 via object origin, but I don't want it to center it when Player1 is near the play field edge. In a nutshell, I want the field edge never to show near the center of the screen.

Lastly, I have a question about Strings. Are Strings similar to Values except it uses letters instead of numbers? I planed to use Strings for a shield ON/OFF effect, but didn't get any results.

 
http://blog.kokoarcade.com

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
6th June, 2008 at 10:07:07 -

Do:
While player's X position is greater than whatever amount of pixels (Something a little higher than half your screen width. Default would be 320) and less than the width of the level minus the same number, AND the same thing for vertical (But use half the vertical length.), center on character. That wasn't too clear... but I was in a hurry to post first.

I don't know exactly what you're trying to accomplish, but I'm guessing, educatedly, that strings are not going to be what you want.

Image Edited by the Author.

 

  		
  		

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
6th June, 2008 at 11:15:36 -

Strings are kind of like Values only you can use Letters as well as numbers. So long as you know how to use the string parser quite well you can use them to store data however you see fit.

 
.

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
6th June, 2008 at 11:45:15 -

Indeed. Strings are handy for a number of things, and if you intend to do something like having multiple shields with names, and combine the process of identifying the shield currently on for programming purposes with displaying the name onscreen, it'd be perfect... but I'd bet values would be a better bet for this. Of course, I don't know what setup you have. Was my viewpoint explanation clear enough?

 

  		
  		

Kokocipher



Registered
  03/06/2008
Points
  439
7th June, 2008 at 08:57:28 -

You can't add nor subtract from String can you?

 
http://blog.kokoarcade.com

Aptennap



Registered
  23/04/2004
Points
  916
8th June, 2008 at 01:00:38 -

Well you can add to a string by doing Current Alterable String + "New Text", where you have saved the string you want to add to in the alterable string. For substracting String Parser can be used I guess, but I don't know how exactly.

 
Oh sweet mary.

Kokocipher



Registered
  03/06/2008
Points
  439
8th June, 2008 at 20:19:00 -

I see, Strings are kind of like texts. It's useful for AI dialogs

 
http://blog.kokoarcade.com

Kokocipher



Registered
  03/06/2008
Points
  439
21st June, 2008 at 16:59:02 -


Originally Posted by OldManClayton
Do:
While player's X position is greater than whatever amount of pixels (Something a little higher than half your screen width. Default would be 320) and less than the width of the level minus the same number, AND the same thing for vertical (But use half the vertical length.), center on character. That wasn't too clear... but I was in a hurry to post first.



I did what you told me (please see the image). It works ok; however, it's still not perfect. The reason is that if Player1 is beyond Y coordinates but not X coordinates, View point will stop executing the "centering" command. So basically if Player one is at the bottom of the screen, it will lose centering. Because of this, I think there must be an alternative method of centering.

Image


My game settings are 800x600, Viewpoint is set to 400x300

Image Edited by the Author.

 
http://blog.kokoarcade.com

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
21st June, 2008 at 20:11:51 -

Oops, guess I wasn't clear enough. You should split the events. Do X separately from Y. Have it center the X during the X conditions' trueness, and center the Y during the Y conditions' trueness.

EDIT: I sure did a bang-up job of giving confusing explanations on this thread, didn't I? While the said X conditions are true, set X position of camera to X position of player. In a separate set of conditions: While Y conditions are true, set the Y of the camera to the Y of the player. I should have said that before.

Image Edited by the Author.

 

  		
  		

Kokocipher



Registered
  03/06/2008
Points
  439
22nd June, 2008 at 10:33:42 -


Originally Posted by OldManClayton
Oops, guess I wasn't clear enough. You should split the events. Do X separately from Y. Have it center the X during the X conditions' trueness, and center the Y during the Y conditions' trueness.



I have to enter both the X and Y coordinates when using Viewpoint's Centering command. Let's say I only want to center X(Player1), what can I possibly put in the Y part?

Image Edited by the Author.

 
http://blog.kokoarcade.com
   

Post Reply



 



Advertisement

Worth A Click