Solved

timing of an event

Posted on 2009-05-19
1
155 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

Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Visual Studio hangs on running project 6 82
c#, case, if 4 37
Shared Service Environment 2 54
Why am I losing my session variable value 11 35
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

739 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