Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

frogger move

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying 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

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

618 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