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.

DarkBASIC Discussion / Shiftkey and Closer than 60 pixels of an object.

Author
Message
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 8th Mar 2005 11:16
Title explains it. HOw do I make it to where the one miage controlled by you will change when the shiftkey is held and he is at the most 60 pixels away?

THanks inadvanced!

___________________________________________________________
Visit my temp Page for video games!
http://www.freewebs.com/goodboys_dog
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 8th Mar 2005 21:10
I really don't understand what you're talking about, however, to do something if the shiftkey is pressed;


Sipmle, no?

Please search the index in the help files next time, it is there for a reason, thanks.


Team EOD :: Programmer/All-Round Nice Guy
Aust. Convention!
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 8th Mar 2005 23:31
Yes, I know how to do that. I want to know if this will work?



Will that work? IF not what can I do to make it work?

___________________________________________________________
Visit my temp Page for video games!
http://www.freewebs.com/goodboys_dog
BearCDPOLD
21
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 9th Mar 2005 10:02
That will work as long as image 1, x2, and x are all pointing to the right values. Be sure also that if you want to just delete that one image, that you clear the screen and re-paste all other images.

Crazy Donut Productions
Current Project: A Redneck game
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 9th Mar 2005 23:12 Edited at: 10th Mar 2005 08:40
Okay, HOw do I make it to where if the x object is 60 or LESS? I have tried
What is another way to do this??

___________________________________________________________
Visit my temp Page for video games!
http://www.freewebs.com/goodboys_dog
BearCDPOLD
21
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 10th Mar 2005 09:43
Oh...you're missing some very important knowledge dude:

if shiftkey()=1 and x2<=x+58
delete image 1
endif


Your relational operators consist of
= : is equal to
< : is less than
> : is greater than
<= : is less than or equal to
>= : is greater than or equal to
<> : is not equal to

Crazy Donut Productions
Current Project: A Redneck game
P Schnell
20
Years of Service
User Offline
Joined: 13th Feb 2005
Location:
Posted: 10th Mar 2005 09:44 Edited at: 10th Mar 2005 09:46
Maybe:


So if x2 is less than 61, which is 60 or less, the image would be deleted. Just use the < operator.

EDIT:Yep, he beat me to it. And I didn't know <> worked in DBC, thanks!

I'd been using:



NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 12th Mar 2005 00:56 Edited at: 12th Mar 2005 01:02
vgames master,

Are you only wanting to detect distance on the x axis? If not, and you are needing to detect distance between two objects on both the x and y axises, try this formula.

sqrt((xpos1 - xpos2)^2 + (ypos1 - ypos2)^2), where xpos1 and ypos1 is the player character, and xpos2 and ypos2 is anything else. This will give you the distance between two points at any angle and any value(negative or positive).

So, in your code you are wanting to detect distance if the SHIFTKEY() is pressed. So, try


+NanoBrain+
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 12th Mar 2005 07:49
Thanks. I think NanoBrain's idea will work. I know that


This ^^ will work. But not as I Want it to work. IF the object is ANYWHERE away from 60 pixels of the other object the code would work. That's not what I want. But thanks for the try of helping. IT feels good to know that people really are willing to help.

Anyway, I will try NanoBrain's code and see if it works.

------------------------
Visit my temp Page for video games!
http://www.freewebs.com/goodboys_dog My Goodboys Dog Website I have game reviews, and a chat applet!!
blanky
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: ./
Posted: 17th Mar 2005 05:19
Meh. NanoBrain, if you are going to keep on being this helpful you're going to end up being a moderator.

Mr Blanky - This Time, It's Personal

Login to post a reply

Server time is: 2025-05-23 21:31:57
Your offset time is: 2025-05-23 21:31:57