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

Username:   Password: 
 RegisterRegister   
 How Do I Code A Pic.Draw to Sense Collisions from all points of Player.
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
jaki723




PostPosted: Mon Jun 05, 2023 5:01 pm   Post subject: How Do I Code A Pic.Draw to Sense Collisions from all points of Player.

What is it you are trying to achieve?
I'm trying to get collision for falling so that it sense all parts of the player sprite and not just two separate points like I have done. If there is a better way by using something else like a draw box or something please let me know.


What is the problem you are having?
It creates too much code if we want to input every single coordinate of the sprite. With only two points the player will fall off edges and sometimes not even sense smaller objects.


Describe what you have tried to solve this problem
I don't know what else to try to solve this problem. I don't want too much code but I can't seem to simplify it.

Please specify what version of Turing you are using
I'm using Turing 4.1.1



Player.bmp
 Description:
 Filesize:  1.4 KB
 Viewed:  2243 Time(s)

Player.bmp



Damaged.bmp
 Description:
 Filesize:  1.08 KB
 Viewed:  2243 Time(s)

Damaged.bmp



Level1.bmp
 Description:
 Filesize:  309.43 KB
 Viewed:  60 Time(s)

Level1.bmp



Collision1.bmp
 Description:
 Filesize:  309.43 KB
 Viewed:  57 Time(s)

Collision1.bmp



Tiny Tim.t
 Description:

Download
 Filename:  Tiny Tim.t
 Filesize:  2.22 KB
 Downloaded:  191 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
scholarlytutor




PostPosted: Thu Jun 08, 2023 11:55 am   Post subject: RE:How Do I Code A Pic.Draw to Sense Collisions from all points of Player.

Thanks for including the code and pictures. I got the program running.

I assume you're talking about when the character falls down a pit, correct?

I see no need to have to sense all the pixels in the sprite. The only thing that matters is the y value of any of the bottom pixels. I believe Pic.Draw uses the bottom left pixel as the position where the character is drawn from

So as soon as the Y value of that bottom left pixel becomes 0 (meaning they have touched the bottom edge of the screen), they need to stop falling and you should show the damaged character (perhaps with a delay of 250-500 milliseconds) then put the normal picture back on top.

For falling off platforms, if the character is moving left, it should be their x value + how many pixels wide the character is which determines whether they fall, so they don't start to fall too early, which seems to be happening at the moment.

If I'm misunderstanding anything, please feel free to clarify.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: