Solved

timing of an event

Posted on 2009-05-19
1
156 Views
Last Modified: 2013-12-17
I am using vb.net with silverlight but anyone  with vb.net knoiwledge can answer this.

I have a game loop and when an object moves off another object I need to know.

I can use either an event to inidicate when this happens or a class variable to test when this happens.

1)If I use an event, then during the middle of some procedure the vent can be raised making planning for this code hard to do. So the event can
happen at a time that could be hard to work in.

2) If I test a variable to see if this has happened I can work it in during a lot easier  in the game loop.

what do i do?
0
Comment
Question by:jagguy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 16

Accepted Solution

by:
CuteBug earned 500 total points
ID: 24430917
If you do not want to handle the scenario, when one object moves off another object, in the middle of some procedure, then the best way would be to test the value of the variable which will indicate that the object has moved.

But in this case, there may be a delay when you respond to the object movement. Suppose Object A moves off ObjectB. So it sets a variable called MovedOff (say).

But the place where you check the status of the variable might not be reached immediately. The application might be busy executing the statements preceding it.


So if you want to respond immediately to the object movement, use events.
Otherwise you can use the variable.
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question