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

Username:   Password: 
 RegisterRegister   
 collision border
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Velocity




PostPosted: Mon Dec 12, 2011 4:48 pm   Post subject: collision border

How do i set borders for my game? So that if you move the rectangle right and it hits a wall it cant go past that wall
Sponsor
Sponsor
Sponsor
sponsor
Velocity




PostPosted: Mon Dec 12, 2011 5:02 pm   Post subject: RE:collision border

Never mind problem resolved, how do i delete this thread?
mirhagk




PostPosted: Mon Dec 12, 2011 5:35 pm   Post subject: RE:collision border

Threads actually don't normally get deleted, usually they are resolved and just remain so that others can view them and get help without having to create new topics.
Aange10




PostPosted: Mon Dec 12, 2011 8:55 pm   Post subject: RE:collision border

However, this thread is pointless as it provides no solution to somebody wondering 'How do I set collision with borders'. I believe we were discussing something in the gist of the scenario a while back - the comic of the man frustrated to find a thread with no useful information in it.


Should be deleted.
mirhagk




PostPosted: Mon Dec 12, 2011 9:39 pm   Post subject: RE:collision border

Yeah, I just realized that you delete your last post, so he probably could've deleted his first post and the thread perhaps, until he and we replied to it.
Velocity




PostPosted: Mon Dec 12, 2011 9:41 pm   Post subject: RE:collision border

here ill post the solution that i found out:

if x1 >= maxx - 125 or x2 >= maxx - 25 then
x1 -= 10
x2 -= 10
end if
if x1 <= 0 or x2 <= 25 + 100 then
x1 += 10
x2 += 10
end if

so pretty much if the bottom left corner of my paddle (since it is further away from the corner and my paddle x lengths vary 100 points between eachother and my border is 25 points away from the side of my screen it says that the maximum x value - 25 points is my x1 value) touches the bottom right corner of my border or if the bottom right corner of my paddle (same as i explained above touches the border) it will decrease 10 points from the x1 value and x2 value making it so that it cannot get past that point. and same thing for the other side except it exactly the opposite.

^^^^^ hope that sort of makes it clear although my explanation sort of sucks.
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  [ 6 Posts ]
Jump to:   


Style:  
Search: