Posts: 3
Threads: 1
Joined: Aug 2007
Hello, I know this is probably simple for most people but I'm having a hard time figuring it out. What I'm trying to do is to get a pixel shoot accross the screen from a certain point everytime a certain key is pressed...the problem I'm having is I want to be able to press the key in rapid succession, only everything I try has to finish executing the second, third or whichever shot then it goes back to the shot before it and finishes it and the goes to the first shot and finishes it...not at ALL how I want it. Any advice? I'm pretty much a QB newb but I should be able to get anything you can tell me. Thanks.
Posts: 1,138
Threads: 211
Joined: Feb 2020
What most programs do when they need to fire multiple objects is to use an array of them, but it does make it slightly more complicated. I'll see if I get a chance to make an example.
Posts: 1,688
Threads: 119
Joined: Jun 2003
any chance we could see your source code to see what your doing? i don't know if i quite follow what your trying to do. seems to me to be some basic particle handling.
Jumping Jahoolipers!
Posts: 243
Threads: 12
Joined: Aug 2001
Here is a demo of a particle moving.
Fire more than once to see two moving at the same time.
Mac
http://www.network54.com/Forum/190883/me...179497831/
Posts: 3
Threads: 1
Joined: Aug 2007
Well I don't have any source, but basically it's kinda like that link to that little game there except I would like to shoot just single pixels in screen 13 but I don't want to be limited to X amount I would like to be able to just keep pressing a button and firing bullets(pixels) as much and as fast as I want. Like I said before though my main problem is that I can only control 1 pixel at a time and it interrupts the flight of the previous pixels. So lets say if I made a type with an X and Y value and I made an array of MyType could I somehow have a loop that would always update MyType(i).X and MyType(i).Y or something? It's causing me alot of trouble but I know it's probably really easy. Thanks for the help, more help would be appreciated too. =)
Posts: 243
Threads: 12
Joined: Aug 2001
Code:
TYPE Pixel
colr AS INTEGER ' Color
curh AS INTEGER
curv AS INTEGER
goalh AS INTEGER
goalv AS INTEGER
END TYPE
CONST MaxPixels = 20
DIM p(MaxPixels) AS Pixel
SCREEN 13
DO
 FOR i = 1 TO MaxPixels
  IF p(i).colr = 0 THEN
   p(i).colr = 15 '3 + INT(RND * 3)
   p(i).curh = 150
   p(i).curv = 100
   p(i).goalh = RND * 300
   p(i).goalv = RND * 200
   PSET (p(i).goalh, p(i).goalv), 12
  ELSE
   Match = 0
   PSET (p(i).curh, p(i).curv), 0: ' Erase old pixel
   SELECT CASE p(i).curh
   CASE IS < p(i).goalh: p(i).curh = p(i).curh + 1
   CASE IS > p(i).goalh: p(i).curh = p(i).curh - 1
   CASE IS = p(i).goalh: Match = 1
   END SELECT
   SELECT CASE p(i).curv
   CASE IS < p(i).goalv: p(i).curv = p(i).curv + 1
   CASE IS > p(i).goalv: p(i).curv = p(i).curv - 1
   CASE IS = p(i).goalv: Match = Match + 1
   END SELECT
   IF Match = 2 THEN
    p(i).colr = 0
   ELSE
    PSET (p(i).curh, p(i).curv), p(i).colr
   END IF
  END IF
  IF c = 3 THEN c = 0: WAIT &H3DA, 8: WAIT &H3DA, 8, 8 ELSE c = c + 1
 NEXT i
 FOR i = -1 TO 1: FOR j = -1 TO 1: PSET (150 + i, 100 + j), 8: NEXT j: NEXT i
LOOP WHILE INKEY$ = ""
END
Posts: 3
Threads: 1
Joined: Aug 2007
Thank you very much, that is EXACTLY what I'm trying to do. All help is much appreciated...I'm sure I will be back in the future with more questions! ;D Thanks again for all the help.