Solved

frogger move

Posted on 2009-05-11
1
465 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 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

18 Experts available now in Live!

Get 1:1 Help Now