Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / [LOCKED] A simple rifle sight (for the 3rd time asking)

Author
Message
paulhenry
16
Years of Service
User Offline
Joined: 20th Jun 2008
Location:
Posted: 9th Feb 2009 09:50
Does anybody know the technique to make a cross hair sight activated by the spacebar and controlled with the mouse please.

xxxxxxxxxPlease note do not post lewd remarks when people are trying to learnxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 9th Feb 2009 10:31
People will be rude when you don't listen to what they say.

This was answered before in one of your previous threads of the same name.

If you don't understand, explain to us which bit your stuck with, and we will help.

But don't expect ppl to write your game for you.

Without Music or Love the world would be a very empty place... Thank god I still have music.. --'-<@
paulhenry
16
Years of Service
User Offline
Joined: 20th Jun 2008
Location:
Posted: 9th Feb 2009 10:36
Do you not understand Please do not post lewd remarks,Where does it say please write a game for me,what I was hoping was for a couple of examples which i can test,yet after asking 3 times for some simple examples alls I get for answers are bull from know it alls.
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 9th Feb 2009 11:12
I'm not the one being impolite sir;

I don't see what is wrong with Kira Vakaan's example that he provided for you.

If you could say where your having problems with it, then I could help you.

If you insist on being obtuse than no one will help you.

Without Music or Love the world would be a very empty place... Thank god I still have music.. --'-<@
paulhenry
16
Years of Service
User Offline
Joined: 20th Jun 2008
Location:
Posted: 9th Feb 2009 11:30
Im not saying that Kira`s answer was not a smart answer,it was but it is not commented and is too cryptic for me to break down without any remarks.The reasoning behind the question a SIMPLE sight technique which I can test,not a game with a sight with no explanations or comments which is why I posted my code so you know where and how to apply the techniques,but no-one seems to have the patience to answer a simple question.
Veron
18
Years of Service
User Offline
Joined: 22nd Nov 2006
Location:
Posted: 9th Feb 2009 11:59 Edited at: 9th Feb 2009 12:01
How do you know that it's so simple if you can't do it yourself? You have no idea of the complexity of it.

When it comes to Kira's example - did you mention this to him/her? I'm sure that Kira would have been able to clean up the code, and even explain and comment it for you.

Kira gave you some great code, and you don't want to learn, you just want his/her code adapted to fit exactly into your game. That's the reason you posted your code.

paulhenry
16
Years of Service
User Offline
Joined: 20th Jun 2008
Location:
Posted: 9th Feb 2009 12:10
Do you not understand DO NOT POST LEWD remarks,all the time the insults are being traded could have been spent better answering the question,alls I did was post my code and everybody started crying they dont want to write a game for me.
lucifer 1101
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Melbourne, Australia
Posted: 9th Feb 2009 12:24
there just discussing why you would post up your code with nothing to say, it was as if you wanted somebody to mix the codez together.

Kira has provided me with much uncommented and commented code and im grateful for that but even i think that giving snippets like that is too much...

All you have to do is break it down into what you know does what and then post here what you dont know and that will be explained to you in time!

Dont be in such a hurry to make a game or it will turn out all wrong, the process is simple but its long (once you get some experience), i know this from experience and trust me it never goes well......

come back when you have tried commenting some of the code yourself, then try asking some questions.

Is that clear enough or should i spell it out for you!
paulhenry
16
Years of Service
User Offline
Joined: 20th Jun 2008
Location:
Posted: 9th Feb 2009 12:35
The only thing that is clear are the insults from the know it alls,pretending to help is getting everybody nowhere fast.Has no-one got a technique for a sight they would like to share,not a game which isnt very clear.
Veron
18
Years of Service
User Offline
Joined: 22nd Nov 2006
Location:
Posted: 9th Feb 2009 12:36 Edited at: 9th Feb 2009 12:37
Quote: "Do you not understand DO NOT POST LEWD remarks,all the time the insults are being traded could have been spent better answering the question,alls I did was post my code and everybody started crying they dont want to write a game for me."


And all the time that you're saying this junk, you could be asking for help on the code which was posted for you. If you don't understand certain parts, then ask! We've provided the code, and you're saying that you can't understand it... so ask us for help! Don't expect us to re-invent the wheel.

Quote: "The only thing that is clear are the insults from the know it alls,pretending to help is getting everybody nowhere fast.Has no-one got a technique for a sight they would like to share,not a game which isnt very clear."


Like I said above... code was posted for you, so explain why you can't use that. If it's because you don't understand parts of it, then tell us that flat out so we can help you understand it.

lucifer 1101
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Melbourne, Australia
Posted: 9th Feb 2009 12:44
Quote: "The only thing that is clear are the insults from the know it alls,pretending to help is getting everybody nowhere fast.Has no-one got a technique for a sight they would like to share,not a game which isnt very clear. "


I have not seen one single insult here and i do not pretend to help and im not helping, i am in no way a know it all and am requiring help constantly.

I bet that everyone here could come up with several ways of doing what you are asking.

here try this

if space
move camera playerx+100,playery,playerz
draw crossing lines (1,100)
endif

thats an example of how it could be done (do not try to use)

the only bit of advice i can give is do some tutorials come back and read all the posts above me, then ask some questions about the code given to you!!
paulhenry
16
Years of Service
User Offline
Joined: 20th Jun 2008
Location:
Posted: 9th Feb 2009 12:54
Ok,when I tested the code from Kira,I got a sphere and a sight,when I tried to remove the sphere and just keep the sight I struggled.To show you my code I firstly need to know how to get a code box up,I cant get my code into the code snippet for some reason,the technique I used was to copy my code from dbp and paste it in the message box,highlight it then press code but it is wrong somehow,so what technique is used for a code snippet and then I can show you my code.
Veron
18
Years of Service
User Offline
Joined: 22nd Nov 2006
Location:
Posted: 9th Feb 2009 13:07
For a code snippet, use this:

[.code]Put your code in here[./code]

Remove the dots that I placed there. For example:



paulhenry
16
Years of Service
User Offline
Joined: 20th Jun 2008
Location:
Posted: 9th Feb 2009 13:15

set display mode 1024,768,32,1
sync on

autocam off
hide mouse

create bitmap 1,32,32
lock pixels
ink 0,0
box 0,0,32,32
ink rgb(255,255,255),0
line 15,0,15,31
line 16,0,16,31
line 0,15,31,15
line 0,16,31,16
unlock pixels
get image 1,0,0,32,32
delete bitmap 1
set current bitmap 0

sprite 1,screen width()/2,screen height()/2,1
offset sprite 1,15,15
hide sprite 1

make object sphere 1,10

for a=2 to 11
make object box a,rnd(20),rnd(20),rnd(20)
position object a,rnd(500),object size y(a)/2.0,rnd(500)
next a

make matrix 1,500,500,10,10
set matrix wireframe on 1

Speed#=1

do
set cursor 0,0
print screen fps()

if spacekey() then xrotate object 1,wrapvalue(object angle x(1)+mousemovey()/8.0) : else: xrotate object 1,0
yrotate object 1,wrapvalue(object angle y(1)+mousemovex()/8.0)

vx#=0 : vz#=0
if keystate(17) then inc vx#,Speed#*sin(object angle y(1)) : inc vz#,Speed#*cos(object angle y(1))
if keystate(31) then dec vx#,Speed#*sin(object angle y(1)) : dec vz#,Speed#*cos(object angle y(1))
if keystate(30) then inc vx#,Speed#*sin(object angle y(1)-90) : inc vz#,Speed#*cos(object angle y(1)-90)
if keystate(32) then dec vx#,Speed#*sin(object angle y(1)-90) : dec vz#,Speed#*cos(object angle y(1)-90)

position object 1,object position x(1)+vx#,5,object position z(1)+vz#

position camera 0,object position x(1),object position y(1),object position z(1)
rotate camera 0,object angle x(1),object angle y(1),object angle z(1)

if spacekey()
show sprite 1
else
hide sprite 1
xrotate camera 0,30
move camera 0,-25
endif

sync
loop

end

could you REM out everything except the sights and controlling the sights please.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 9th Feb 2009 13:26
left the boxes and matrix in.



Dark Physics makes any hot drink go cold.
paulhenry
16
Years of Service
User Offline
Joined: 20th Jun 2008
Location:
Posted: 9th Feb 2009 13:31 Edited at: 9th Feb 2009 13:32
Many thanks for the reply,can you tell me before I try to adapt the code what the boxes are for,and I already have a matrix.If the boxes are supposed to be the player could you rem them out also.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 9th Feb 2009 13:38 Edited at: 9th Feb 2009 13:50
they are there in this demo so that you can see that it move like keystate(32) is one of the a,w,s,d keys the move the camera using the now hidden sphere.



this is what make the boxes that are there so that you can see something move.

this is what you would have seen if there where no boxes or matrix.

SDo would have siad this does on thing.



Edit
here it is in gosubs




Dark Physics makes any hot drink go cold.
paulhenry
16
Years of Service
User Offline
Joined: 20th Jun 2008
Location:
Posted: 9th Feb 2009 13:57
The problem is I already have a object and rotation values assigned to it,I will attempt to put my code in a snippet box again so that both can be blended into one program as nobody has explained a simple technique for using a sight which I have the ability to adapt to my own code.


HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 9th Feb 2009 14:13
can not say if this will run but the codes in place up to you to put the right object numbers into it.



Dark Physics makes any hot drink go cold.
paulhenry
16
Years of Service
User Offline
Joined: 20th Jun 2008
Location:
Posted: 9th Feb 2009 14:25
Thanks alot,it almost runs but I get a error runtime error 302-sprite does not exist at line 201.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 9th Feb 2009 14:30
replace old gosub with this.



Dark Physics makes any hot drink go cold.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 9th Feb 2009 14:36 Edited at: 9th Feb 2009 14:38
here try this had put the make cross hairs in the loop should have been out side.



Dark Physics makes any hot drink go cold.
paulhenry
16
Years of Service
User Offline
Joined: 20th Jun 2008
Location:
Posted: 9th Feb 2009 14:51 Edited at: 9th Feb 2009 14:55
Thanks again,I changed the code to the code below but it repeats the previous error at show sprite 1,line 201.





EDIT-with the updated code it stops again and says sprite does not exist at line 201.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 9th Feb 2009 15:22
this you could have done all I did was knock out the sprite command and see if it worked, it did.



Dark Physics makes any hot drink go cold.
paulhenry
16
Years of Service
User Offline
Joined: 20th Jun 2008
Location:
Posted: 9th Feb 2009 15:41
Many thanks again,but its not working out,so could a simple technique be explained for the sights,for example the code for a cross hair,to show when the space key is pressed firstly and progress from there.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 9th Feb 2009 15:57
Are asking how does make cross hair gosub works?

Dark Physics makes any hot drink go cold.
paulhenry
16
Years of Service
User Offline
Joined: 20th Jun 2008
Location:
Posted: 9th Feb 2009 16:07
No,I know the gosub command,what im asking is for the explanation of a cross hair from a fresh start,which enables me to code it into my game,step by step instead of lots of problems.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 9th Feb 2009 16:14
well I did work out that by hidding the sprite in this bit youm
wrote


that when you let go if the spacebar the sprite would go away. so spacebar pressed cross hairs appear, spacebar not pressed no cross hairs.

Dark Physics makes any hot drink go cold.
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 9th Feb 2009 21:02
Now I read this this morning and started on a snippet, but then had to go away fo a while, so maybe you've already solved it by now.
Anyhow, this is really simple (yes, I'm really giving you "tha codez"! );


"We know some things about poodles, for example that they are alive, they can bark, they eat meat..."
- Extract from Objects first with Java.
Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 10th Feb 2009 05:34
Quote: "many thanx,ill post my code for you to adapt after you tell me how to get the box up in which you put your code"

sounds alot like asking someone to write it for you...

anyways, there is a simple technique that's being used in that demonstration.

1. Position the camera in the center of your character.
2. Paste an aiming reticule on the screen.

anyways, the code you have (posted in another one of your threads) looks like a good start. You should really try more to look through other peoples code though. If theres a command that you don't understand, then look it up in the dbpro help files. If you still don't understand it, look it up on the forums.

also... don't post the same question multiple times. So far you haven't asked any specific questions about the code, you've just said that you don't understand it.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 10th Feb 2009 11:36
Thread Locked

This thread has been locked for the following reason: 3 posts on the same topic in 2 days, followed by unacceptable posting.

AUP Section 3.17 ...Moderators shall, at their discretion, determine what constitutes a violation of theses terms, along with generally accepted nettiqute standards, and can take action against those who violate these rules.

If you contributed to the reason for locking, you may now find yourself on moderation, or in extreme cases a ban.

Login to post a reply

Server time is: 2024-11-24 13:06:16
Your offset time is: 2024-11-24 13:06:16