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.


How to create sprite/ moving figures?


Reply
 
LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 05-17-2007, 05:35 PM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 203
Default

I changed it somewhat to

Sub Globals
Height=5: LastHeight=5: dY=5
Width=5: LastWidth=5: dX=5
HeightMin = 5: HeightMax = Form1.Height-5
WidthMin = 5: WidthMax = Form1.Width-5
End Sub

Sub App_Start
Form1.Show
Form1.ForeLayer=True
BounceBall
End Sub

Sub BounceBall
Height = Rnd(HeightMin,HeightMax)
Width = Rnd(WidthMin,WidthMax)
FOR x=1 to 1000
For y=1 to 1000
NEXT
DoEvents
LastWidth=Width
LastHeight=Height
Form1.FErase(LastWidth-5,LastHeight-5,LastWidth+5,LastHeight+5)
Height=Height+dY
Width=Width+dX
Form1.FCircle(Width,Height,5,cRed,F)
IF Height>=HeightMax Then
Height = HeightMax
dY = -dY
END IF
IF Height<=HeightMin Then
Height = HeightMin
dY=-dY
END IF
IF Width >= WidthMax then
Width = WidthMax
dX = -dX
END IF
IF Width <= WidthMin then
Width = WidthMin
dX = -dX
END IF
NEXT
End Sub
Reply With Quote
  #12 (permalink)  
Old 05-17-2007, 07:05 PM
RandomCoder's Avatar
Basic4ppc Veteran
 
Join Date: May 2007
Location: UK
Posts: 487
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Looks like you've got the idea then

I thought afterwards that I could have just erased a full strip that would have covered the whole area the ball travels, however this might not have been as good a demonstration as actually recording the last position.
Furthermore, if you plan on using an image and moving that around then you should quite easily be able to erase the position it occupies just by locating it's top and left position.

Regards,
RandomCoder
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD.
Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD.

"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #13 (permalink)  
Old 12-29-2008, 05:03 AM
Junior Member
 
Join Date: Nov 2008
Posts: 11
Default

Sub Globals
Height=10: Dim g
End Sub

Sub App_Start
g=1.05
Form1.Show
Form1.Line(0,200,Form1.Width,200,cBlack)
SetTransparentColor=cGreen
Form1.ForeLayer=True
Form1.FCircle(Form1.Width/2,Height,10,cBlack,F)
Timer1.Interval =50
Timer1.Enabled=True
End Sub


Sub Timer1_Tick
Form1.FCircle(Form1.Width/2,Height,10,cGreen,F)
direction=direction*g
Height=Height*g
If Height>190 Then
Height=190
g=0.95
End If
If Height<=10 Then g=1.05
Form1.FCircle(Form1.Width/2,Height,10,cBlack,F)
End Sub
Reply With Quote
  #14 (permalink)  
Old 12-31-2008, 08:57 AM
willisgt's Avatar
Senior Member
 
Join Date: Aug 2007
Location: Nacogdoches, Texas USA
Posts: 164
Default

Isn't there already a Sprite library?

(...rummages through boxes looking...)

I'm sure there's a Sprite library in here somewhere...


Gary
__________________
PC: Windows XP Pro SP3 / Basic4PPC v6.5
PPC: HTC 8925 (AT&T Tilt) / Windows Mobile 6
Reply With Quote
  #15 (permalink)  
Old 12-31-2008, 09:30 AM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Switzerland
Posts: 819
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Yes, it is here:
Sprite library - V1.1
__________________
Klaus
Switzerland
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
Drawing and moving a Character Transparently (Not a Sprite) Drewpeu Questions & Help Needed 2 10-08-2008 04:15 PM
Diff GPS values without moving GPS mouse Georg Questions & Help Needed 1 04-22-2008 07:58 AM
moving a sprite? colin9876 Questions & Help Needed 7 11-27-2007 05:10 PM
XYCalc -graphs an equation or editable table of figures in regular, bar or pie chart HarleyM Code Samples & Tips 2 11-24-2007 08:21 AM
Error when moving treeview to a tabcontrol Peter Questions & Help Needed 2 05-15-2007 07:36 AM


All times are GMT. The time now is 07:49 PM.


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