?
Solved

frogger move

Posted on 2009-05-11
1
Medium Priority
?
481 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
[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 11

Accepted Solution

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

764 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