|
Post by blitzreality on Feb 27, 2005 17:55:10 GMT -5
[glow=red,2,300]ok how do i make a character stay in the center of the view. i am making an rpg called Knight's Land and may add an online for the second. plz if u help u will be it the credits[/glow]
|
|
|
Post by Nailog on Feb 27, 2005 19:23:10 GMT -5
(You didn't mention which version you use, so I'm going to assume GM 6, since that is what I use.)
The first thing you'll want to do is enable the use of views. In the room editor, on the Views tab, is a checkbox with the label Enable the use of Views. Make sure that is checked.
Next, make sure view 0 is being used. If View 0 isn't bold, click on View 0, and then click on the Visible when room starts checkbox.
Lastly, in the Object following section at the bottom, select your player object in the little selection box. Try out the game, and then adjust the Hbor and Vbor values, probably making the numbers higher. Ploay around with it until it works as you want it.
(I use GML to make a view follow a player, so I'm not completely sure about the last part. Experimentation should solve the problem, though.)
|
|
|
Post by blitzreality on Feb 27, 2005 19:26:22 GMT -5
lol i would like the gml please because i am making this game with mostly no d&d. but thanks for the good explination but all i neeed is the gml or the code for doing this. thanl you lol and yes i am using gm6[td]cool lol[/td]
|
|
|
Post by Nailog on Feb 27, 2005 19:33:02 GMT -5
In that case, there are 4 variables you'll need.
view_xview[view_num] : X position of left edge view_yview[view_num] : Y position of top edge view_wview[view_num] : Width of view view_hview[view_num] : Height of view
In the player's Step or Draw event, you want to move the view to make it center on the player character. If you've taken algebra, the math shouldn't be too hard. But just in case, you'll want to do something like ...
view_xview[view_num] = player_x - floor(view_wview[view_num] / 2); view_yview[view_num] = player_y - floor(view_hview[view_num] / 2);
|
|
|
Post by IsmAvatar on Feb 27, 2005 19:53:13 GMT -5
No D&D is required. No GML is required. It's all right there in the GM GUI. You need to turn on ((Enable Use of Views)) and ((Visible When Room Starts)). Then select the object to follow. Then adjust the hbor and vbor as necessary, like Nailog said before.
|
|