Alohaaa :) I am working on a little game and just started creating the environment in which the chracter moves around, that creates itself randomly as it is discovered, now, the thing is i want to make it in this particular way, but makes the movement pretty much rough, any ideas on how to make it smoother??? avoid lag and staff???
The main for has only a Gridview (H455 x W483) and then 3 pictues (32 x 32) water.png, grass.png and forest.png added to data ' Gambas module file (var) Public posx As Integer Public posy As Integer Public teclas As Boolean ' Gambas class file Private $hConn As New Connection Private $res As Result Public Sub _new() End Public Sub Form_Open() GridView1.Columns.Count = 13 GridView1.Rows.Count = 13 GridView1.Columns.Width = 37 GridView1.Rows.Height = 35 GridView1.ScrollBar = 0 var.posx = 6 var.posy = 6 datab() End Public Procedure datab() Dim hTable As Table With $hConn .Type = "sqlite" .host = User.home .name = "" End With If Exist(User.home & "/test.sqlite") Then cargar() Else $hConn.Open $hConn.Databases.Add("test.sqlite") $hconn.Close $hconn.name = "test.sqlite" $hConn.Open hTable = $hConn.Tables.Add("sampleTable") hTable.Fields.Add("xy", db.String) hTable.Fields.Add("field", db.String) hTable.Fields.Add("step", db.String) hTable.Update earthtype() Endif End Public Procedure earthtype() Dim $Query As String Dim $Result As Result Dim $info As String Dim rTest As Result Dim xu As Integer Dim yu As Integer Dim cxy As String Dim fy As Integer Dim fx As Integer Dim alea As Integer Dim steper As String Dim nw As String Dim xuc As Integer xu = var.posx - 6 yu = var.posy - 6 xuc = xu 'Message.Info(cxy) For fy = 0 To 12 For fx = 0 To 12 cxy = xu & "-" & yu $Query = "select * from sampleTable where xy = '" & cxy & "'" $Result = $hconn.Exec($Query) If $Result.Count = 0 Then alea = Rnd(0, 100) Select alea Case 0 To 5 nw = "water.png" steper = "no" GridView1[fy, fx].Picture = Picture[nw] GridView1[fy, fx].Text = steper Case 6 To 10 nw = "forest.png" steper = "no" GridView1[fy, fx].Picture = Picture[nw] GridView1[fy, fx].Text = steper Case Else steper = "yes" nw = "grass.png" GridView1[fy, fx].Picture = Picture[nw] GridView1[fy, fx].Text = steper End Select $hconn.Begin rTest = $hConn.Create("sampleTable") rTest!xy = cxy rTest!field = nw rTest!step = steper rTest.Update $hConn.Commit Else $info = $Result!field GridView1[fy, fx].Picture = Picture[$info] $info = $Result!step GridView1[fy, fx].Text = $info Endif xu += 1 Next xu = xuc yu += 1 Next GridView1[6, 6].Picture = Picture["front.png"] End Public Sub form_KeyPress() If var.teclas = False Then Goto escapar var.teclas = False Select Key.Code Case Key.Left If GridView1[6, 5].Text = "yes" Then var.posx -= 1 Else Endif Case Key.Right If GridView1[6, 7].Text = "yes" Then var.posx += 1 Else Endif Case Key.Up If GridView1[5, 6].Text = "yes" Then var.posy -= 1 Else Endif Case Key.Down If GridView1[7, 6].Text = "yes" Then var.posy += 1 Else Endif End Select earthtype() escapar: End Public Procedure cargar() With $hConn .Type = "sqlite" .host = User.home .name = "test.sqlite" End With $hConn.Open earthtype() End Public Sub form_KeyRelease() var.teclas = True End ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user