VBugs Mousepoint not Working

Using the C# or Visual Basic.NET version of SwinGame and you've found a bug? Let us know about it and we will look into it when we get a chance. Please let us know what operating system you are using, the exact error, when it occurs, etc. the more detail you provide the easier it will be for us to replicate the problem.

VBugs Mousepoint not Working

Postby oodan on Fri Sep 09, 2011 8:26 pm

Hi Im currently working through Vbugs and im up to the part where you have to replace the cursor with the 'target' picture, but when i type in: Graphics.DrawBitmapOnScreen(GameImage("ImageName"),
mousePoint.X, mousePoint.Y)
it doesnt seem to recognise the mousepoint command. Can someone please help?
oodan
Apprentice
 
Posts: 6
Joined: Fri Sep 09, 2011 8:15 pm

Re: VBugs Mousepoint not Working

Postby acain on Fri Sep 09, 2011 9:09 pm

mousePoint should be a variable you declared, if you post up the code you have I can let you know what you need to do to get it to work.
Cheers,

Andrew Cain
----------
Swinburne University of Technology
Lecturer of Software Development in PSD
User avatar
acain
Site Admin
 
Posts: 252
Joined: Wed Dec 05, 2007 2:35 pm
Location: Swinburne University - Hawthorn - Melbourne

Re: VBugs Mousepoint not Working

Postby oodan on Sat Sep 10, 2011 4:21 pm

Hi acain here is the code

Module GameLogic
Public Sub Main()
'Opens a new Graphics Window
Core.OpenGraphicsWindow("Game", 800, 600)

'Open Audio Device
Audio.OpenAudio()

'Load Resources
LoadResources()
Dim bug As Sprite

bug = Graphics.CreateSprite(GameImage("sprite"))

bug.Movement.X = 0.5
bug.Movement.Y = 0.5

'Make the mouse cursor dissapear
Input.ShowMouse(False)

'Game Loop
Do


'Clears the Screen to Black
SwinGame.Graphics.ClearScreen()

'Replace mouse with a target
Input.GetMousePosition()
Graphics.DrawBitmapOnScreen(GameImage("target"), mousePoint.X, mousePoint.Y)



'Move the bug and bounce it off the wall
Graphics.DrawSprite(bug)
Graphics.UpdateSprite(bug)
If bug.X + bug.Width + bug.Y + bug.Height >= Core.ScreenWidth + Core.ScreenHeight Then
bug.Movement.X = -0.5
bug.Movement.Y = -0.5
Audio.PlaySoundEffect(GameSound("hit20"), 5, 1)
End If
If bug.X + bug.Width + bug.Y + bug.Height <= 0 Then
bug.Movement.X = 0.5
bug.Movement.Y = 0.5
Audio.PlaySoundEffect(GameSound("hit20"), 5, 1)
End If

If Input.IsKeyPressed(Keys.VK_UP) = True Then
Audio.SetMusicVolume(Audio.MusicVolume + 0.01F)

End If
If Input.IsKeyPressed(Keys.VK_DOWN) = True Then
Audio.SetMusicVolume(Audio.MusicVolume - 0.01F)
End If



'Refreshes the Screen and Processes Input Events
Core.RefreshScreen()
Core.ProcessEvents()

Loop Until SwinGame.Core.WindowCloseRequested() = True

'Free Resources and Close Audio, to end the program.
FreeResources()
Graphics.FreeSprite(bug)
Audio.CloseAudio()
Music.Stop()
End Sub

End Module
oodan
Apprentice
 
Posts: 6
Joined: Fri Sep 09, 2011 8:15 pm

Re: VBugs Mousepoint not Working

Postby acain on Sat Sep 10, 2011 9:19 pm

At the top near dim bug... Add

Dim mousePoint as Point2D

Then change input.GetMousePosition() to

mousePoint = Input.GetMousePosition()

and it should work for you :)

Hope that helps.
Cheers,

Andrew Cain
----------
Swinburne University of Technology
Lecturer of Software Development in PSD
User avatar
acain
Site Admin
 
Posts: 252
Joined: Wed Dec 05, 2007 2:35 pm
Location: Swinburne University - Hawthorn - Melbourne

Re: VBugs Mousepoint not Working

Postby oodan on Sun Sep 11, 2011 10:23 am

Yeah that works great, Thanks acain!!
oodan
Apprentice
 
Posts: 6
Joined: Fri Sep 09, 2011 8:15 pm


Return to C# or Visual Basic.NET Bugs

Who is online

Users browsing this forum: No registered users and 1 guest

cron