473,385 Members | 1,357 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to test for collision with pygame corner, and drag selected corner?

How do I test a collision between two Rect objects to see if one collides with the other at a certain position?

Expand|Select|Wrap|Line Numbers
  1.  
  2. pseudocode ---
  3.  
  4. if event.type == pygame.MOUSEBUTTONDOWN:
  5.     if mouseRect(imageRect.bottomleft):
  6.         action1()
  7.     if mouseRect(imageRect.bottomright):
  8.         action2()
  9.  
  10.  
Mar 10 '12 #1
0 1258

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: J. W. McCall | last post by:
I'm not sure if this is off-topic, since it doesn't deal with Python itself, but here goes: I'm messing around with writing a simple "game" where the player (a crudely drawn smiley face) moves...
1
by: Thomas Zimmermann | last post by:
I have a form with a subform in datasheet view. Now, I want to trigger a procedure (P1) each time the user selects an entire column (by clicking in the heading) in the subform. The procedure (P1) I...
2
by: Blaze Bresko | last post by:
Hi, I am trying to make a game using either livewires or pygame. The game is tetris. Right now I have gotten the program to a point where everything works (as in user input, score, lines, etc),...
1
by: liuliuliu | last post by:
hi -- sorry if this is trivial -- but how do you make a screenshot of a pygame display? i have a surface which is basically the entire visible screen -- how do you write this surface as an image...
5
by: enquiring mind | last post by:
Running 2.4.1 Python (learning) Running SUSE Linux 10 Am learning from a new books that mostly deals with windows python and Pygames called "Game Programming" by Randy Harris (2007) His books...
1
by: kidelectric | last post by:
The issue I am having is that I would like to be able to drag-and-drop div elements that have rounded corners.* Since these elements will be dynamically created (including background color), I could...
10
by: exodus | last post by:
As a fun little task to gain more knowledge of python, i decided to try to mimick the ipod UI with it. here's what i've got so far #!/usr/bin/env python # -*- coding: utf-8 -*- # generated by...
3
by: Raj Kumar | last post by:
hi i am a begineer in javascript... is it possible to move image one page to next page using drag and drop
0
by: Michael Sparks | last post by:
Hi, Just thought some people may be interested to hear that I've recently been looking at adding true concurrency into Kamaelia, by using Paul Boddie's pprocess as the core mechanism to allow...
2
by: Tom Bean | last post by:
I wrote an C# application that uses drag and drop to copy the contents of one ListViewItem to another. I call DoDragDrop() in the ItemDrag event handler, however, the ItemDrag event is being fired...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.