Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Boundaries For Game Using Sprites
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
PuterFreak




PostPosted: 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?
Sponsor
Sponsor
Sponsor
sponsor
PuterFreak




PostPosted: 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




PostPosted: 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




PostPosted: 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




PostPosted: 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:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: