Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Basic4ppc Wishlist
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Basic4ppc Wishlist Missing any feature?


Sprite attributes (properties)


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-27-2009, 03:12 PM
Senior Member
 
Join Date: Oct 2007
Location: U.K.
Posts: 185
Default Sprite attributes (properties)

It would be very helpful IMHO if sprite collision (ability) could be turned on/off and still have the sprite visible and doing things. It would seem to me that it could save a lot of interrupts uneccessarily and could save a lot of testing code.

If this can be done already in some way I would be grateful to hear of it.
__________________
You never stop learning until you die.
Sometimes I think I am dead.
Sometimes others think I am dead!
Reply With Quote
  #2 (permalink)  
Old 06-28-2009, 05:50 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 3,351
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Erel has given me the go-ahead to produce a new version of the Sprite library which will be the next official release. Try the attached Sprite library version 1.21.

The changes over the current Sprite library are :-

Added a Sprite.ID property that lets you name or number a Sprite and so identify a particular Sprite returned as Sprite1 or Sprite2 in a collision.

Added a GameWindow.GetSpriteID(id) method that returns a reference to a Sprite with the specified ID. This can be assigned to a Sprite Value property to manipulate the Sprite.

Added a GameWindow.CheckSpriteCollisions boolean property. True (the default) checks for Sprite collisions, set to to False to stop Collisions occurring

Modified the Sprite.IntersectsPoint hit test to work properly (I hope!).

Post here any further changes you can think of.
Attached Files
File Type: zip Sprite1.21.zip (7.3 KB, 30 views)
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #3 (permalink)  
Old 06-28-2009, 08:17 PM
Senior Member
 
Join Date: Oct 2007
Location: U.K.
Posts: 185
Default

Wow, thank you very much. I have not downloaded yet but had to reply with gratitude.
__________________
You never stop learning until you die.
Sometimes I think I am dead.
Sometimes others think I am dead!
Reply With Quote
  #4 (permalink)  
Old 06-28-2009, 08:26 PM
Senior Member
 
Join Date: Oct 2007
Location: U.K.
Posts: 185
Default

Thank you agraham and of course Erel for permission. I can confirm that the Intersection problem is now solved and it works correctly, pixel perfect!!
__________________
You never stop learning until you die.
Sometimes I think I am dead.
Sometimes others think I am dead!
Reply With Quote
  #5 (permalink)  
Old 06-28-2009, 08:31 PM
Senior Member
 
Join Date: Oct 2007
Location: U.K.
Posts: 185
Default

Not wishing to appear greedy, but will you please now explain how to get over the double event triggered by a collision when neither sprite is going to be deleted.
It appears (from an earlier post I made) that the system will not simply ignore it by counting two and then dealing with it. This would of course be what is commonly called the icing on the cake.
__________________
You never stop learning until you die.
Sometimes I think I am dead.
Sometimes others think I am dead!

Last edited by enonod : 06-29-2009 at 07:26 AM.
Reply With Quote
  #6 (permalink)  
Old 06-29-2009, 07:50 AM
Senior Member
 
Join Date: Oct 2007
Location: U.K.
Posts: 185
Default

Sorry about the multi posts but I assume editing might not get noticed.
I have checked the new anti-collision and I believe there was a misunderstanding or reading.
Quote:
...and still have the sprite visible and doing things
My original intention was that individual sprites could be prevented from being collideable via a Boolean property. It might be that say 10 sprites should never or perhaps only under certain conditions be permitted to collide.
To turn the collision mechanism off altogether is undoubtedly useful, but please could the original request (possibly badly explained) be considered?
It could be done now using your new ID and filtering it in the collision sub, I presume, but it doesn't prevent the collision sub being called and slowing the system down. Of course I don't know how this could possibly be done, but sprites do already have some properties and this could presumably be just one more???
[Edit]Sorry to be a bore but I tried this and I get the error Object must first be created.... The idea of all this is to do something to a specific sprite if it collides but not if it is some other sprite.

gw.s has been created as a sprite and works
Quote:
s has been created as a sprite and works
s.ID="Fred" seems OK
spr1 has also been in use ok

Sub gw_collision
Spr1.value=gw.Sprite1

If spr1.ID<>"Fred" Then
spr1.Velocity=6
...
__________________
You never stop learning until you die.
Sometimes I think I am dead.
Sometimes others think I am dead!

Last edited by enonod : 06-29-2009 at 08:25 AM.
Reply With Quote
  #7 (permalink)  
Old 06-29-2009, 09:23 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 3,351
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

I am going to rewrite collisions later today or tomorrow so I'll look at it then.
Quote:
Originally Posted by enonod View Post
I get the error Object must first be created....
Those lines of code appear to work fine for me. Which object on which line?
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #8 (permalink)  
Old 06-29-2009, 11:04 AM
Senior Member
 
Join Date: Oct 2007
Location: U.K.
Posts: 185
Default

Quote:
I am going to rewrite collisions later today or tomorrow so I'll look at it then.
Thank you very much for that.

Sorry for not being clear... it refers to the first line in the collision sub
Spr1.value=gw.Sprite1
Spr1 has been in the objects list all along and not presented a problem.

[Edit] Profound apology... a typo, leaving in a comment marker. Works fine
__________________
You never stop learning until you die.
Sometimes I think I am dead.
Sometimes others think I am dead!

Last edited by enonod : 06-29-2009 at 11:49 AM.
Reply With Quote
  #9 (permalink)  
Old 06-29-2009, 12:26 PM
Senior Member
 
Join Date: Oct 2007
Location: U.K.
Posts: 185
Default

Having got over the self inflicted error, I find that the following produces '0' on both labels.
The if is handled as true for either gw.sprite1 or 2 and the two id's are "cw" and "fred".
I cannot see that anything is wrong with the code, so I will leave it with you while you do your rewrite.
Quote:
Sub gw_collision
label3.Text=gw.Sprite1.id
label4.Text=gw.Sprite2.id
Spr1.value=Gw.sprite2
If spr1.id <> "Fred" Then
spr1.Velocity=20
End If
End Sub
Thanks.
__________________
You never stop learning until you die.
Sometimes I think I am dead.
Sometimes others think I am dead!
Reply With Quote
  #10 (permalink)  
Old 06-29-2009, 01:17 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 3,351
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

I'm afraid your code is wrong. Basic4ppc can't handle compound references to properties and methods like "gw.Sprite1.ID". The IDE doesn't error this but returns 0 or an empty string. The optimising compiler will however error it, though not with a helpful message. You need to use this code.
Code:
Sub gw_collision
  Spr1.value=Gw.Sprite1
  Spr2.value=Gw.Sprite2
  label3.Text=Spr1.ID
  label4.Text=Spr2.ID
   ...
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Assembly properties Pachuquin Questions & Help Needed 1 05-05-2009 06:42 PM
Compiled Properties Zenerdiode Basic4ppc Wishlist 4 03-06-2009 09:54 PM
Properties module - useful module for working with properties / ini files Erel Code Samples & Tips 0 11-07-2008 09:01 PM
Evaluate properties Offbeatmammal Basic4ppc Wishlist 0 06-02-2008 07:23 AM
More properties for panels RandomCoder Basic4ppc Wishlist 0 07-12-2007 09:48 PM


All times are GMT. The time now is 08:51 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0