The Daily Click ::. Forums ::. Klik Coding Help ::. Extend view
 

Post Reply  Post Oekaki 
 

Posted By Message

Willy C



Registered
  14/02/2004
Points
  1524

Game of the Week WinnerKlikCast StarPicture Me This -Round8- Winner!VIP MemberWii OwnerIt's-a me, Mario!Hero of TimeThe Cake is a LiePS3 OwnerI am an April Fool
Batman!Teddy Bear
15th December, 2007 at 14:41:35 -

Hi. I am making a top view action game. And I want the player to be able to extend his view, just a bit, when he is using a certain weapon. So moving the crosshair he can view more of the play field, but while the player character is still visible in this view....

How can I do this?

 
http://www.robocaptain.com

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
15th December, 2007 at 14:54:15 -

What kind of aiming are you using? Mouse based?

 
Craps, I'm an old man!

Willy C



Registered
  14/02/2004
Points
  1524

Game of the Week WinnerKlikCast StarPicture Me This -Round8- Winner!VIP MemberWii OwnerIt's-a me, Mario!Hero of TimeThe Cake is a LiePS3 OwnerI am an April Fool
Batman!Teddy Bear
15th December, 2007 at 14:57:28 -

yeah. You aim with the mouse

 
http://www.robocaptain.com

NeoMonkey

Finnish Army Fire Commander

Registered
  01/12/2006
Points
  243

VIP Member360 OwnerI am an April FoolPS3 Owner
15th December, 2007 at 15:01:00 -

If I understood right you want soldat style of aiming (sniper), but your char is always on screen.

If I would make it it would go like:

Always:
-Center display (0,0) from crosshair

And then you have to stop the crosshair by doing something like creating a circle which has different sizes like 16x16 and 32x32. And when the weapon changes so the animation of the circle (therefore the circles size rises and view size rises)

This is how I woul do it, but i could have miss understood waht you are lookin for.



 
I have proven new mathematic formula to be true...

2D > 3D

Image


Willy C



Registered
  14/02/2004
Points
  1524

Game of the Week WinnerKlikCast StarPicture Me This -Round8- Winner!VIP MemberWii OwnerIt's-a me, Mario!Hero of TimeThe Cake is a LiePS3 OwnerI am an April Fool
Batman!Teddy Bear
15th December, 2007 at 15:04:32 -

I've tried that, it would be very hard to find a "in-between aim". I don't know how to explain it. But it would be really hard to aim. The aim has to be more smooth.

 
http://www.robocaptain.com

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
15th December, 2007 at 15:18:58 -

Distance formula for a circle: x² + y² = r²

r is the radius of the circl you want

for example, you want the weapon crosshair to be(at most) 30 pixels (r² = 900)

Distance = (Xcrosshair - XCharacter)² + (Ycrosshair - YCharacter)²

Distance < 900 =
Crosshair: Set position to (XMouse, YMouse)

This will limit it so that whilst the total distance is within the circle, it will move.

Now, for repositioning it to the edge of the circle when it escapes this, you will probably need to use a fastloop.

Any position on the circle is given by (rcosA, rsinA)
r is the maximum radius, A is the angle between the crosshair and the centre of the circle (the character)

If you combine this with a center playfield at the crosshair, whilst having a maximum distance, you should be able to achieve the affect you desire.

Image Edited by the Author.

 
My signature is never too big!!!

Willy C



Registered
  14/02/2004
Points
  1524

Game of the Week WinnerKlikCast StarPicture Me This -Round8- Winner!VIP MemberWii OwnerIt's-a me, Mario!Hero of TimeThe Cake is a LiePS3 OwnerI am an April Fool
Batman!Teddy Bear
16th December, 2007 at 05:20:50 -

I'm probably really stupid. But I didn't get that, Joe. Can you be more straight forward?

 
http://www.robocaptain.com

DeadmanDines

Best Article Writer

Registered
  27/04/2006
Points
  4758
16th December, 2007 at 06:24:09 -

Please Joe, I know that's how it's written in textbooks, but I'm a strong campaigner that if you're gonna write a formula to explain something to a clicker, please include a version in actual click expression code. So people can see how the classical notation can be converted into MMF code.

So basically, if you want to find the distance between two points, using the formula Joe quoted, you do this:

sqr((X("Crosshair") - X("Player") pow 2 + (Y("Crosshair") - Y("Player") pow 2)


So you can use the 'Compare two general values' or something like that in the Special Object under Conditions, and in the top box type the above formula, and in the bottom, type what you wanna compare it to (e.g. 100 pixels).

 
191 / 9999 * 7 + 191 * 7

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
16th December, 2007 at 06:42:00 -

What he said ^

 
My signature is never too big!!!

Willy C



Registered
  14/02/2004
Points
  1524

Game of the Week WinnerKlikCast StarPicture Me This -Round8- Winner!VIP MemberWii OwnerIt's-a me, Mario!Hero of TimeThe Cake is a LiePS3 OwnerI am an April Fool
Batman!Teddy Bear
16th December, 2007 at 08:13:50 -

I'm having some real troubles with this. Joe has tried to help out over messenger, but he doesn't have MMF anymore. Does anyone want to make a quick example file?

 
http://www.robocaptain.com

NeoMonkey

Finnish Army Fire Commander

Registered
  01/12/2006
Points
  243

VIP Member360 OwnerI am an April FoolPS3 Owner
16th December, 2007 at 10:29:18 -

I tried this and well when using the centered scrolling in crosshair it looks stupid, because mouse moves fast also the map scrolls too fast. This way the crosshair stops, but I don't think it works well in the game.

Image Edited by the Author.

 
I have proven new mathematic formula to be true...

2D > 3D

Image


markno2



Registered
  06/06/2006
Points
  865

Game of the Week WinnerVIP MemberPicture Me This Round 30 Winner!Weekly Picture Me This Round 39 Winner!Kliktober Special Award Tag
16th December, 2007 at 11:18:45 -

Is this what you were looking for?

http://www.freewebs.com/markno2/topview_camera_extension.zip

(copy+paste URL or right-click save as)

edit: I just realised mine creates a square region, Joe's created a circle. It's 2am and I overlooked that.

Image Edited by the Author.

 
Discarded pizza boxes are an indispensable source of cheese.

Willy C



Registered
  14/02/2004
Points
  1524

Game of the Week WinnerKlikCast StarPicture Me This -Round8- Winner!VIP MemberWii OwnerIt's-a me, Mario!Hero of TimeThe Cake is a LiePS3 OwnerI am an April Fool
Batman!Teddy Bear
16th December, 2007 at 11:29:53 -

Thats it man! Thanks! It doesn't matter that it doesn't move in a perfect circle, I just need a way to extend the view. Thanks a bunch!

 
http://www.robocaptain.com

NeoMonkey

Finnish Army Fire Commander

Registered
  01/12/2006
Points
  243

VIP Member360 OwnerI am an April FoolPS3 Owner
16th December, 2007 at 12:11:27 -

Ah dam someone made before me, but I think when you are making sniper etc. you need longer extended view, and then it is a mess, because the camera moves too fast.

http://rapidshare.com/files/77014245/ExtVision.rar.html

In my example (in my opinion) the camera is much better.

Edit: I forgot the source so I'll explain it here:

o Start of frame
-Hide windows pointer

o Always
-Center display at X=X("[Player]")+(X("[Crosshair]")-X("[Player]"))/3
-Center display at Y=Y("[Player]")+(Y("[Crosshair]")-Y("[Player]"))/3
-[Crosshair]: Set X position to XMouse
-[Crosshair]: Set Y position to YMouse

Here by changing the divider (3), if it is lower than 3 i looks farther and over 3 then it looks shorter distance.
(In full screen and other I suggest divider to be 2 or under)

This is easy way and not buggy (in my opinion), and not be needing any counters or etc. and its not so stupidly fast when you move your crosshair.

Image Edited by the Author.

Image Edited by the Author.

 
I have proven new mathematic formula to be true...

2D > 3D

Image

   

Post Reply



 



Advertisement

Worth A Click