|
-
Jan 15th, 2003, 04:46 PM
#1
Thread Starter
Member
collision and selection rts question/problem thingy
ok, im makin an rts game (not dx... im not to good in it yet)
during the code all the people and stuff are Rects
then i "render" the rects that r on the coordinates of where the screen is on the map
now in theory, that would work... im just not 100% on how to do it:
since im drawing everything using transblt on a picture box.. how would i have the prog no when i selected... say a person and which person...
could i do something like (not exact code,just a ruf outline)
on pic_click..()
if mousex and mousey > pics x etc
blah blah... more if its on the coordinates of ne rect
then:
do the stuff
endif
end sub
ok u should get the point, but a few things
1. i think i would have to loop the part where it goes thru and checks if the mouse is on a rect.. cuz i would have to do like
do until i > numOfBuildings
if mousex > blah blah building(i).x then
etc etc stuff
end if
then how would i tell if its being selected.. would i have to make some sort of an index on each thing as i make em?
and i get an error .. i forgot wut it is now (ill post source n **** later) i think it was an overflow when i tried getting the left or right or nething of a rect and comparing it to the mouses... which doesnt make ne sense...
neways, ill post the basic source later
thx in advance
gl on understanding wut i wrote
Visual Basic 6.0, Visual Basic .NET, C#, C++, ASM, HTML
-
Jan 16th, 2003, 06:08 AM
#2
Fanatic Member
Use a control array, in the click event use the "index" to know which image is which.
Image1_click(x,...,index)
image(index).left = image(index).left + 1
end sub
that would make the picure you click on move to the left.
Question: How are you doing your unit pathing?
Don't pay attention to this signature, it's contradictory.
-
Jan 18th, 2003, 08:41 AM
#3
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|