Charas-Project

Game Creation => Requests => Tutorials => Topic started by: ThexXtremeXx on November 03, 2008, 10:09:47 PM

Title: Crosshair
Post by: ThexXtremeXx on November 03, 2008, 10:09:47 PM
I want to make a crosshair that stays the same amount of space away from the hero but can move any help?
Title: Re: Crosshair
Post by: DragonBlaze on November 03, 2008, 10:37:14 PM
Is this crosshair a picture or charset? And will it rotate a full 360 degrees or will it just be displayed in front of the hero in whatever direction he is facing?
Title: Re: Crosshair
Post by: ThexXtremeXx on November 03, 2008, 11:22:20 PM
charset/whatever direction he is facing
Title: Re: Crosshair
Post by: DragonBlaze on November 03, 2008, 11:45:50 PM
Ok, hmm crap I don't have rpg maker on my computer, but I'll do the best I can.

First off, put a crosshair event on every map, give it the graphic of the crosshair. Make it a parallel process event. Give it the "above hero" attribute, and give a custom move patern of "passability mode" or "phasing on" whatever its called.

In that event, put a .0 wait at the start.
Record the x and y possitions.
Do four conditional branches (one for each of the dirrections the hero is facing. )
if up, subtract some from the hero y (amount is up to you).
Use the command "change event location" and select the crosshair, and use the x and y.
For the other conditional branches, just add or subtract to the x and y to line it up right.

Then just set it up so that the crosshair event only changes its location of the hero changes his direction (do this by recording the dirrection the hero was in, then check it against the hero's current dirrection (done with a conditional branch)).

Then just move the crosshair with the hero. (Done by four conditional branches for key pressed, if key is down, move the crosshair down, ect)

I hope thats enough of the concept to get you started
Title: Re: Crosshair
Post by: Desimodontidae on November 03, 2008, 11:51:50 PM
Yeah it'll probably take a bit of playing around to get right, though. Actually, that would probably make for a decent flashlight code too, DB. Of course probably using pictures instead of a charset, but you can use the same principle.
Title: Re: Crosshair
Post by: ThexXtremeXx on November 03, 2008, 11:55:55 PM
well, i under stood the first part but then i got lost,but I'll try it anyway, thanks!
Title: Re: Crosshair
Post by: DragonBlaze on November 04, 2008, 12:05:52 AM
make something like this

wait 0.0
variable [hero x position] = hero x position
variable [hero y position] = hero y position
variable[hero dirrection] = hero facing
if [hero dirrection] does not equal [old dirrection]

if (hero is facing up)
 [hero y position] - 5
 Change event location (to [hero x position] and [hero y position]
 [old dirrection] = up
END if

if (hero is facing down)
 [hero y position] + 5
 Change event location (to [hero x position] and [hero y position]
 [old dirrection] = down
END if

(do the left and right ifs too)

END if

Key input process
if (left pressed)
 move crosshair left
END if

if (right pressed)
 move crosshair right
END if

do the other two ifs for the left and right keys

Title: Re: Crosshair
Post by: ThexXtremeXx on November 27, 2008, 05:44:08 PM
doesnt work. well atleast you tried to help.