Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
[source] How to make bombs drop while player still play game
Author Message

Posted: Sat Jan 03, 2004 8:47 pm   Post subject: [source] How to make bombs drop while player still play game

Mimi asked for a code, that allows a player to drop bombs, and have the bombs drop without disappearing while the character moves. So I thought, some other people may want to know how it is done, so here it is.
 code: var playerx, playery : int playerx := 20 playery := 380 var key : string (1) := "" var num, counter : int := 0 var bombx, bomby : array 1 .. 200 of int for i : 1 .. 200     bombx (i) := -20     bomby (i) := -20 end for loop     setscreen ("offscreenonly")     View.Update     delay (5)     num := num + 1     Draw.FillBox (0, 0, maxx, maxy, 255)     Draw.FillBox (playerx - 20, playery - 20, playerx + 20, playery + 20, 1)     if hasch then         getch (key)     end if     if key = (KEY_RIGHT_ARROW) and playerx < maxx - 10 then         playerx := playerx + 6     elsif key = (KEY_LEFT_ARROW) and playerx > 10 then         playerx := playerx - 6     end if     for i : 1 .. 200         if bomby (i) < 0 then             bombx (i) := -20             bomby (i) := -20         end if         if bombx (i) not= -20 and bomby (i) not= -20 then             Draw.FillOval (bombx (i), bomby (i), 15, 15, 12)             bomby (i) := bomby (i) - 18         end if     end for     if counter >= 5 then         if bombx (num) = -20 and bomby (num) = -20 then             bombx (num) := playerx             bomby (num) := playery - 15             counter := 0         end if     end if     counter := counter + 1     if num = 199 then         num := 0     end if end loop

Use it how you wish, if you can pick th rough the code. (Its not hard to do that) Ive used this kind of thing (with arrays) for multiple t hings, from this, to saving where bullets have been in a shooter game. Enjoy

kalin

Posted: Wed Jan 21, 2004 4:04 pm   Post subject: (No subject)

Err...Interesting??

Posted: Wed Jan 21, 2004 8:41 pm   Post subject: (No subject)

nah..n ot really too interesting...I just submited it just in case anybody needed to know how to do it.
kalin

Posted: Wed Jan 21, 2004 8:44 pm   Post subject: (No subject)

didn't you notice the '?'s' at the end of that????
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 4 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: