Game Maker Community YoYo Games

Welcome Guest ( Log In | Register )

> Novice Forum Rules

Novice and intermediate users who are using Drag & Drop action icons, or still learning GML, can get help from more experienced members.

Please READ the Novice Q&A Forum Rules prior to posting. And remember that the General GMC Rules apply here too.

 
Reply to this topicStart new topic
Please Help!, Help with views
Pikmet23
post Nov 1 2009, 11:20 PM
Post #1


GMC Member
Group Icon

Group: GMC Member
Posts: 33
Joined: 15-August 07
Member No.: 86137



I'm making a Metroid game and having trouble with the view.

Currently the view follows me wherever I go, but I don't want that all the time.

For example:

BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
OOOOOOOOOOOOBBWWWWWWWWWWW
OOOOOOOOOOOOBBWWWWWWWWWW
OOOOOOOOOOOOBBWWWWWWWWWWW
OOOOOOOOOOOOBBWWWWWWWWWW
BBBBBBBOOOOOOBBWWWWWWWWWW
BBBBBBBOOOOOOBBWWWWWWWWWWW
WWWBBOOOOOOOBBWWWWWWWWWW
WWWBBOOOOOOOBBWWWWWWWWWWW
WWWBBOOOOOOOBBWWWWWWWWWW
WWWBBOOOOOOOBBWWWWWWWWWWW
WWWBBOOOOOOOBBBBBBBBBBBBBBBB
WWWBBOOOOOOOBBBBBBBBBBBBBBBB
WWWBBOOOOOOOOOOOOOOOOOOOOOO
WWWBBOOOOOOOOOOOOOOOOOOOOOO
WWWBBOOOOOOOOOOOOOOOOOOOOO
WWWBBOOOOOOOOOOOOOOOOOOOOO
WWWBBBBBBBBBBBBBBBBBBBBBBBBBB

O= Open
W and B are both blocks
I dont want to see W

Any help?

Go to the top of the page
 
+Quote Post
drt_t1gg3r
post Nov 2 2009, 12:20 AM
Post #2


GMC Member
Group Icon

Group: GMC Member
Posts: 2878
Joined: 3-August 05
Member No.: 32637



then 'edit' your post and delete the 'W's
Go to the top of the page
 
+Quote Post
Pikmet23
post Nov 2 2009, 12:59 AM
Post #3


GMC Member
Group Icon

Group: GMC Member
Posts: 33
Joined: 15-August 07
Member No.: 86137



QUOTE (drt_t1gg3r @ Nov 1 2009, 06:20 PM) *
then 'edit' your post and delete the 'W's


...





Sorry if that was a little unclear. If you ever played a Metroid game you will notice that the view follows you only in the y direction when going down long shafts. And only in the x direction when walking down long corridors. Thats what I am asking for help about.

Go to the top of the page
 
+Quote Post
Vision305
post Nov 2 2009, 01:01 AM
Post #4


GMC Member
Group Icon

Group: GMC Member
Posts: 212
Joined: 16-May 08
Member No.: 107026



I understand you. You want your view not to change if its going to overlapp the edges of the room or the walls or blocks. I also am wanting to know this. Im am working on a top down RTS and have a glitch where you can move the view way outside the room. I gotta fix this and so this is a good question!

This post has been edited by Vision305: Nov 2 2009, 01:04 AM
Go to the top of the page
 
+Quote Post
drt_t1gg3r
post Nov 2 2009, 06:27 PM
Post #5


GMC Member
Group Icon

Group: GMC Member
Posts: 2878
Joined: 3-August 05
Member No.: 32637



metroid game in action

okay, above is a video of metroid from NES. can you help explain more of what it is you want
Go to the top of the page
 
+Quote Post
Pikmet23
post Nov 2 2009, 10:29 PM
Post #6


GMC Member
Group Icon

Group: GMC Member
Posts: 33
Joined: 15-August 07
Member No.: 86137



Sure, but this video better shows what I want: http://www.youtube.com/watch?v=KE1fW6iCNN8...feature=related

Watch around 5:36. As soon as samus swtiches from running vertically to falling horizontally the view doesn't move in the x direction anymore. Because of that you can't see past the 1st layer of blocks that surround the room. Now if would do this same thing on game maker you would be able to see past that layer because the view follows me wherever I go. So how do I fix that?

Thanks for replying lmaosmiley.gif
Go to the top of the page
 
+Quote Post
Pikmet23
post Nov 3 2009, 10:13 PM
Post #7


GMC Member
Group Icon

Group: GMC Member
Posts: 33
Joined: 15-August 07
Member No.: 86137



Do I need to explain further? whistle.gif
Go to the top of the page
 
+Quote Post
Destron
post Nov 3 2009, 10:51 PM
Post #8


GMC Member
Group Icon

Group: GMC Member
Posts: 710
Joined: 19-August 04
From: Iacon
Member No.: 13290



Im assuming you have the borders of the view drawn in tight on the player object so that the player pretty much stays in the center of the screen correct? If so, then you could just manipulate the horizontal borders when the player reaches an area like that and make them smaller so the view does not move side to side ... ill try to make an example real quick ...

Hope this is what you need ...

CLICK HERE

Its in GM7, let me know if you need 6 ill upload a 6 version.

This post has been edited by Destron: Nov 3 2009, 11:46 PM
Go to the top of the page
 
+Quote Post
Pikmet23
post Nov 4 2009, 03:57 AM
Post #9


GMC Member
Group Icon

Group: GMC Member
Posts: 33
Joined: 15-August 07
Member No.: 86137



Thanks alot for the answer!

Right now I'm running into some problems though. I also don't want the view to move up or down during own horizontal movement either. Basically I want the view to move in a grid (so it can't move diagonly).

A problem also occurs when I try to go up because the screen dosn't lock. So, I tried to have an obj_view1 and obj_view2 right next to other to try and fix this but it it didn't work.

Is there a way of making the view move only up or down only when it is alligned to a grid.

Thanks for helping me. snitch.gif
Go to the top of the page
 
+Quote Post
Destron
post Nov 4 2009, 04:18 AM
Post #10


GMC Member
Group Icon

Group: GMC Member
Posts: 710
Joined: 19-August 04
From: Iacon
Member No.: 13290



Not Home right now, posting this from my phone, but for the horizontal you could do it the same way, for the obj_view1 and obj_view2, check which way you are passing through it to determine how to set the borders, are you coming from the top or bottom? When I get home I can update it to include that.
Go to the top of the page
 
+Quote Post
Pikmet23
post Nov 6 2009, 03:28 AM
Post #11


GMC Member
Group Icon

Group: GMC Member
Posts: 33
Joined: 15-August 07
Member No.: 86137



QUOTE (Destron @ Nov 3 2009, 10:18 PM) *
Not Home right now, posting this from my phone, but for the horizontal you could do it the same way, for the obj_view1 and obj_view2, check which way you are passing through it to determine how to set the borders, are you coming from the top or bottom? When I get home I can update it to include that.


Ok, now there is no need to update to include the horizontal part. I figured it out. Thanks anyway


One more thing though. I always want the center of the view to be halfway between the floor and ceiling of a horizontal passage and halfway between the two walls of a vertical passage. All my horizontal passageways are 240 high. All my vertical passages are 272 wide. My view is 272x240.

This is my last question. I promise blink.gif
Go to the top of the page
 
+Quote Post
Pikmet23
post Nov 6 2009, 03:54 AM
Post #12


GMC Member
Group Icon

Group: GMC Member
Posts: 33
Joined: 15-August 07
Member No.: 86137




Ok this is how far I got with that.
CODE

{
var i,j;
i=floor((obj_samus.x)/272);
j=floor((obj_samus.y)/240);


if (other.hspeed>0)
{
view_xview=i*272;
view_hborder[0]=15
alarm[1] = 1
view_vborder[0] += 1
}
if (other.hspeed<0)
{
view_yview=j*240;
view_hborder[0] += 1
alarm[0] = 1
view_vborder[0]=16
}
}


This is in the collision event for object view1 with obj samus.
The i and j part seems to work well except that the view jumps which makes it rather ugly. So how I do this happen slower. You can't make the view move toward a point can you?

Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 23rd November 2009 - 10:37 AM