[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

timing of an event

Posted on 2009-05-19
1
Medium Priority
?
161 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
1 Comment
 
LVL 16

Accepted Solution

by:
CuteBug earned 2000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month18 days, 16 hours left to enroll

834 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