Solved

frogger move

Posted on 2009-05-11
1
467 Views
Last Modified: 2013-12-26
I am making a frogger game and i am confused as to the speed on how the frogger object moves.

I can make it move 32 px on every key press on a frame rate of 10ps. This is as close to real thing looking at current online versions..
The objects move separately on another thread so only the frogger moves at 10fps. Each row is 32 px in height so this is best. However the key response is slow as sometimes the frog doesnt move instantly.

I am using silverlight vb.net

I had a look at other games for how it moves and I cant be right but I am close.

If I have a higher frame rate then frogger object moves quickly and it can appear to move 64px on 1 keypress?

How can i make this think move instantly on a key press and move 32px per move?
0
Comment
Question by:jagguy
1 Comment
 
LVL 11

Accepted Solution

by:
jgordos earned 500 total points
ID: 24377822
Sometimes the simplest questions lead to really really complicated answers.

The truth is, you need to interpolate the animation over the distance moved...

You say that you have the frog moving on an update loop at 10Hz... Is that how often you look for user input, or is that how often you call the update loop for the frog?

The user input portion, if it's running at 10Hz, would be wrong.  You need to look for user input much more quickly... otherwise it will feel slow.

In order to keep the 10Hz loop for the frog, though, the way you do this is to "set a flag" indicating the direction the user wanted to move (up down left right), and then the frog's update loop looks for this flag.

If it's set, he moves in that direction.  After moving, he clears the flag.  In this manner, he can only react to one directional flag at a time.

When the user presses the key...

you need to clear all the movement flags (up down left right) and then set only the flag that they currently indicated.

This should help it feel more responsive...

The general term for what you're talking about is 'key bounce'... you might trying googling some of the articles related to it.

-john


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

932 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now