Basic4ppc - Windows Mobile Development  

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

Questions & Help Needed Post any question regarding Basic4ppc.


Worng Sprite Move?


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-17-2008, 09:07 PM
Junior Member
 
Join Date: May 2008
Posts: 19
Question Worng Sprite Move?

Hi all.

I try using sprite library move, but its seems wrong.

I do...

Code:
Sub GameForm_KeyPress(specialKey)
	Select specialKey
		Case cRightKey, 80
			Move(0, 22)
		Case cLeftKey, 79
			Move(180, 22)
	End Select
End Sub

Sub Move(d, v)
	CellSprite.Direction = d
	CellSprite.Velocity = v
	GameGameWindow.Tick
End Sub
Then when i changed move key, its do a last move on opposite direction, I mean if I do 'Right, Right, Right, Left', last move will be Right.

Another question is if I don't like to do any move (move some sprites and not others), i have to put velocity to 0 or I can put direction, to -1 for example?

Thanks in advance!

Best Regards, fjsantos.
Reply With Quote
  #2 (permalink)  
Old 06-18-2008, 05:13 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,186
Default

The Sprite library which is based on this project: Pocket PC and SpriteHand components first draws the sprites to an off-screen buffer and then draws this buffer to the screen.
This method makes the animation more smooth.
As it is implemented, on every tick the offscreen bitmap is drawn and then it is updated with the new positions.
Changing this logic is more complicated than it might seem.

The solution is to handle the position yourself.
Set the velocity to 0 and just update CellSprite.X and CellSprite.Y.
Reply With Quote
  #3 (permalink)  
Old 06-19-2008, 04:53 PM
Junior Member
 
Join Date: May 2008
Posts: 19
Default

Ok, i will use that instead!
Thanks!
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
sprite move to stylus)) Byak@ Questions & Help Needed 4 08-19-2008 08:58 AM
move to the last row at a table Georg Questions & Help Needed 2 05-20-2008 09:43 PM
MouseDown/Move/Up either in all Controls or not hiding from Form Woinowski Basic4ppc Wishlist 3 11-05-2007 12:36 PM
Measuring distance on move Agrartec Code Samples & Tips 15 08-28-2007 02:43 AM
Move an image inside an image control Cableguy Questions & Help Needed 5 05-14-2007 08:40 PM


All times are GMT. The time now is 04:31 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0