Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (M_D), 1,501 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Help with compass #401581
05/21/12 21:04
05/21/12 21:04
Joined: Apr 2005
Posts: 796
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 796
U.S.A. Michigan
Hey, I am looking for a way to take a HORIZONTAL compass. As in one which is a horizontal bar with N, S, E, W, which rotates with the players(cameras) direction.

Note the compass on top of the mini map.


I have been struggling to get this working and I just cant figure out how to go about doing it. This is what I got so far, and it kinda works but its not working properly.

Code:
compass_pos.x = 996.75 - ((1329/100) * (abs(camera.pan%360) / (360/100)));



If anyone has any idea how I can do this it would be most appreciated.

Re: Help with compass [Re: exile] #401588
05/22/12 04:22
05/22/12 04:22
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
cause you need a window of a panel to do that laugh

Put your compass 3 times, side by side from left to the right, on 1 bitmap. (i would use a 2048 width image). You can use an image in any size you want.. Bur i'd stay below a width of 4096 laugh
As greater your width of the image is, as greater is the amount of detail laugh
Now you know, the PAN Angle has a range from 0..360. Cause our image has 3 compasses on it, our complete angle is 1080.
means:
2048/1080 = 1 degree = 1.89629...

what we do now, is to add our camera.pan to that calculation:
(2048/1080)*camera.pan

we are not ready now.. cause our image stores 3 compasses to get an infinity look, we need to use the middle one. So we jump over the first by adding his size in pixels:
((2048/1080)*camera.pan)+(2048/3)

now, the value is not precise enough.. we need a double for that:
Code:
double compass_pos;
BMAP* bm_comp = "triple_compass.png";

...

compass_pos = ((bitmap_width(bm_comp)/1080)*camera.pan)+(bitmap_width(bm_comp)/3)



now create a Panel, and a window inside. Give the window the bm_comp Bitmap, and as verX parameter, the compass_pos double.

I tried it at this morning, works well laugh

Last edited by Espér; 05/22/12 04:33.

Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1