Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

timing of an event

Posted on 2009-05-19
1
Medium Priority
?
159 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 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses

610 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