Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Boundaries For Game Using Sprites
Author Message
PuterFreak

Posted: Wed Jun 09, 2004 5:10 pm   Post subject: Boundaries For Game Using Sprites

if x1 = maxx then
loop
for x : 1 .. 2
Pic.Draw (zf (x), maxx, y1, picCopy)
end for
end loop
else
end if

this is what i have and it seems logical to me ... if the sprites x position is equal to maxx then redraw the sprite (which is an array of 2 pictures) at maxx thus disableing to move off the screen.... but im a moron and it dont work .... anyone up for helping?

PuterFreak

Posted: Wed Jun 09, 2004 5:12 pm   Post subject: (No subject)

sory bout double postin but this is the line

if x1 = maxx then
loop
for x : 1 .. 2
Pic.Draw (zf (x), maxx, y1, picCopy)
end for
end loop
end if

(no else) =p
Cervantes

Posted: Wed Jun 09, 2004 7:53 pm   Post subject: (No subject)

try changing
 code: if x1 = maxx then

to
 code: if x1 >= maxx then

you are probably moving the sprite by incriments of more than 1 each time through the loop to make it go reasonably fast, and if that's the case, it, depending on its starting position, could jump over the maxx. ie. go from maxx - 1 to maxx + 1 and the if x1 = maxx is never true.
the_short1

Posted: Wed Jun 09, 2004 9:22 pm   Post subject: (No subject)

ur still gona have problesm... cervants is right...

but u will have to do more then just draw at maxx.... u will have to change the coords too... << dont think u had that in there..

if x1 >= maxx then
x1 := maxx- incriment *that ur moving by...
Pic.Draw (parameters)
end if

oterwise when u go to press LEFT ur guy's coords mite be WAY outa the screen and it will take a whgile for u to acuially MOVE the picture!

hope that helps!!
PuterFreak

Posted: Thu Jun 10, 2004 6:30 pm   Post subject: (No subject)

Well, i tried both of your methods but still no luck, My program is a space invaders type of game on the x-axis. I guess i dont need boundaries but i think they are just a little extra. I appreciate ur attempt to help me ^_^ thanx
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 5 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: