Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by dr_panther. 05/18/24 11:01
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
3 registered members (dr_panther, Ayumi, 1 invisible), 708 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Crosshair #253568
02/25/09 14:33
02/25/09 14:33
Joined: Apr 2008
Posts: 245
GameScore Offline OP
Member
GameScore  Offline OP
Member

Joined: Apr 2008
Posts: 245
Hi,
i want to create a nice shooter
and i want the crosshair moves a little bit together with the player
so how can i move the crosshair pannel in the middle of the screen
i want if the player moves left the crosshair follows some pixels and the same up and down

Re: Crosshair [Re: GameScore] #253604
02/25/09 18:25
02/25/09 18:25
Joined: May 2008
Posts: 331
Lithuania, Vilnius
Jaxas Offline
Senior Member
Jaxas  Offline
Senior Member

Joined: May 2008
Posts: 331
Lithuania, Vilnius
search in Lite-C tutorial, workshop14: mouse wink


The smaller the bug, the harder it is to kill.
_________________________________________
Forklift DEMO (3dgs)
Re: Crosshair [Re: Jaxas] #253729
02/26/09 12:53
02/26/09 12:53
Joined: Apr 2008
Posts: 245
GameScore Offline OP
Member
GameScore  Offline OP
Member

Joined: Apr 2008
Posts: 245
i allready read this workshop, thanks
i have this code

//////////////////////////////////////////////////////////////////////////////////////////////////////////
starter move_panel
{
{
var pan_pos[3];
while(1) {

pan_pos.x = clamp(mouse_cursor.x + 100, 100, screen_size.x - 100);
pan_pos.y = clamp(mouse_cursor.y + 100, 100, screen_size.y - 100);
plBipedWeap00_crosshair1_pan.pos_x = pan_pos.x;
plBipedWeap00_crosshair1_pan.pos_y = pan_pos.y;
wait(1);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////

this code works, but not very fine
i can control the crosshair with the mouse and the player follows the crosshair
but if i go to any corner with the crosshair, the crosshair will hang for a short time at this corner
i have no idea why?

Re: Crosshair [Re: GameScore] #253767
02/26/09 17:27
02/26/09 17:27
Joined: May 2008
Posts: 331
Lithuania, Vilnius
Jaxas Offline
Senior Member
Jaxas  Offline
Senior Member

Joined: May 2008
Posts: 331
Lithuania, Vilnius
first of all, you should use mouse_map instead of panel.

function main()
{
....
mouse_map = "your_mouse_BMAP";
mouse_mode = 1;
....
while(1)
{
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
}
}

It's the very basic.

Last edited by Jaxas; 02/26/09 17:28.

The smaller the bug, the harder it is to kill.
_________________________________________
Forklift DEMO (3dgs)
Re: Crosshair [Re: GameScore] #253840
02/27/09 08:39
02/27/09 08:39
Joined: Apr 2008
Posts: 245
GameScore Offline OP
Member
GameScore  Offline OP
Member

Joined: Apr 2008
Posts: 245
ok look at this
this is the code of the workshop 14
i modify it for my effect, i want in my shooter the crosshair moves a little bit in the center of the screen
when i turn left i want the crosshair follows a little bit
and the same with right up and downward
i dont want the mouse run over the full screen
this is the code

////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>

////////////////////////////////////////////////////////////////////

BMAP* cursor_pcx = "cursor.pcx";
BMAP* crosshair_pcx = "crosshair.pcx";

////////////////////////////////////////////////////////////////////

function change_mouse_mode()
{
mouse_mode += 1;
mouse_mode %= 3;
if (1 == mouse_mode)
mouse_map = crosshair_pcx;
if (2 == mouse_mode)
mouse_map = cursor_pcx;
}

function main()
{
video_screen = 1;
video_mode = 9;
level_load ("work14.wmb");
on_m = change_mouse_mode;

while (1)
{
mouse_pos.x = clamp(mouse_cursor.x + 200, 200, screen_size.x - 200);
mouse_pos.y = clamp(mouse_cursor.y + 200, 200, screen_size.y - 200);
camera.pan -= mouse_force.x;
camera.tilt += mouse_force.y;

wait (1);
}
}
//////////////////////////////////////////////////////////////////////////////
please youse this code for the workshop 14
and try it with different video mode
you would see when you turn from left to right everything is allright
but if you turn from right to left the mouse will hang for a short time
please try and tell me why wink

Re: Crosshair [Re: GameScore] #253846
02/27/09 10:23
02/27/09 10:23
Joined: Jan 2009
Posts: 36
Philippines
U
unknown_master Offline
Newbie
unknown_master  Offline
Newbie
U

Joined: Jan 2009
Posts: 36
Philippines
if you want to make a nice crosshair, you need to create_ent wherein the mouse is centered on the screen and put some crosshair pictures on the mouse...i think that there some example in gamestudio...

Re: Crosshair [Re: unknown_master] #253851
02/27/09 10:48
02/27/09 10:48
Joined: Apr 2008
Posts: 245
GameScore Offline OP
Member
GameScore  Offline OP
Member

Joined: Apr 2008
Posts: 245
i dont want a fixed crosshair
please try this code with the workshop 14 and you will see what i mean
it works all like this i want, but the crosshair will hang on the right side if you will turn to the left


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