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
Solved

frogger move

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Run Program using VBScript 3 73
Microsoft App Store does not Download and Update the apps in Windows 10 5 94
Need to create an object factory 2 47
count8 challlenge 13 171
If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

837 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