Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Code Samples & Tips
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Code Samples & Tips Share your recent discoveries and ideas with other users.

MouseMove Events With Sprites

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-15-2009, 08:41 PM
Knows the basics
 
Join Date: Dec 2008
Posts: 77
Awards Showcase
Beta Tester 
Total Awards: 1
Default MouseMove Events With Sprites

As it turns out it is possible to Move Sprites with the Door Library.

I have included a modified SpriteExample that allows this.

In other situations it can be used like this, no Timer is needed unless Sprite.Velocity is used.

Code:
Sub Globals
     mousedown = 
false
End Sub

Sub App_Start
     gw.New1(
"Form1",0,0,Form1.Width,Form1.Height)
           o.New1(
False)  'Door Object added after GameWindow created
           o.FromLibrary ("main.gw","_gw",B4PObject(2))
'Door Events
            eMove.New1(o.Value,"MouseMove"
            eUp.New1(o.Value, 
"MouseUp")
            ePaint.New1(o.Value,
"Paint"'Start the GameWindow without a Timer
     Sprite.New2(AppPath & "\image.png",1,44,44,1)
gw.Tick 
'It Seems to me that using a lot of Ticks, prevents white flashes
     Form1.Show
End Sub

Sub ePaint_newEvent
o.Value = ePaint.Data
     gw.Tick 
End Sub

Sub gw_CollisionMouse    
   mousedown = 
True 'move only when pressing the Sprite area of the GameWindow
gw.Tick
End Sub

Sub eUp_NewEvent
o.Value = eUp.Data
    mousedown = 
false 
gw.Tick
End Sub

Sub eMove_NewEvent
o.Value = eMove.Data
    x = o.GetProperty(
"X")
    y = o.GetProperty(
"Y")

     
If (mousedown) then
Sprite.X = x
Sprite.Y = y
     
End If

gw.Tick
End Sub
Attached Files
File Type: zip SpriteMove.zip (92.0 KB, 77 views)
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 Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
MouseMove position eww245 Questions (Windows Mobile) 3 04-12-2009 05:34 PM
Events for PIM (Outlook) related events dreamcove Questions (Windows Mobile) 1 02-14-2009 12:00 PM
The Mousemove event N1c0_ds Questions (Windows Mobile) 1 11-08-2008 04:36 PM
Help with Sprites and Transparency Drewpeu Questions (Windows Mobile) 1 09-24-2008 07:29 PM
textBox : add TextChanged events or other events abys Code Samples & Tips 1 09-01-2008 07:41 PM


All times are GMT. The time now is 02:14 AM.


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