Using mouse to move object

Blitz3D Forums/Blitz3D Programming/Using mouse to move object

amitjf(Posted 2006) [#1]
I am trying to create a strategy game using mouse to move the character(in third person). When I will click on place the character will go there. how to do that?
(sorry about my english)


Stevie G(Posted 2006) [#2]
Something like this should work ....

Initialise ...

plane = createplane() : entitypickmode plane, 2
target = createsphere() : entitycolor target, 255,0,0
player = createsphere()


In the main loop ....

Picked = camerapick( mousex(), mousey() )
if Picked = plane
   positionentity target, pickedx(), pickedy(), pickedz()
endif

if entitydistance( player, target ) > 10
   turnentity player, 0, deltayaw( player, target )*.1, 0
   moveentity player, 0, 0, .5
endif



The target is a sphere to show you where you're moving to .. normally a pivot would suffice here.

Hope this helps.

Stevie


Nexus6(Posted 2006) [#3]
Dont know if it helped Amitjf or not, but it certainly helped me, Thanks Stevie


Stevie G(Posted 2006) [#4]
Your welcome ... there's alot to be said for common curtesy ;)


Sir Gak(Posted 2006) [#5]
I believe the word is spelled "courtesy". :)


WolRon(Posted 2006) [#6]
Well, that wasn't very courteous...


n8r2k(Posted 2006) [#7]
lol- i believe he likes good manners, not spelling, thats where spell check comes in for me


Sir Gak(Posted 2006) [#8]
Waht, bnieg hfpulel is desicruotous? Sllpieng maktsies are wnorg to hlep poelpe to cecorrt? Srory, did not maen to be drouiscoutes.

(recent discovery: as long as the first and last letters of a word are correct, you can mix up the internal letters of a word, and people can still read them, as the human brain unscrambles them and knows what's being written.)

But seriously, I wasn't out to diss anybody, and am sorry if it was taken that way. Apologies to all.


Ross C(Posted 2006) [#9]
Well, your mostly correct. I have no idea what 25% of those words say ;)


n8r2k(Posted 2006) [#10]
oh no, somethings taking over Sir Gak's mind and making him discourteous*, no spare him, ah nno ti's getttnig mie alos, hepl i don wanat be incosniderit†.


*indicates words I used spell check for

indicates words I used spell check for, but then decided to screw it and leave it the way it is.