Greenfoot iskeydown12/9/2023 ![]() The good news in all this is: with "shift" and "control" being detectable keys, they are, for almost any scenario, enough different key combinations to cover a multitude of events. The movement itself was working flawlessly and wasnt hard to do, but Im having difficulties with the animation. The only keys that work on the numberic keypad are the direction arrow keys and the "enter" key all which are duplicated keys (at least on my keyboard). Hi everyone :) Im trying to code the animation for the movement of the hero in my game. Check whether a given key is currently pressed. These are: "tab", "alt", "F10", "home", "end", "pgdn", "pgup", "ins", "del", and "\" Return a random number between 0 (inclusive) and limit (exclusive). ![]() There are 10 keys (at least, as far as keys that there could possibly be of use in detecting) that cannot be detected. This class contains code which reacts to the 'BadGuy' class and the 'Bullet' Class. Within this class, most of the interactive features can be found. Greenfoot.getRando mNumber(4) Returns a random number. // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) / This is the character in which the player controls. ![]() the problem is that they only fly when i hold one of the arrow keys, when i release it they stop moving i want to press space and left,right,up,down 1 time and 1 bullet fly in the direction given by the arrow keys until it hit an enemy or the border. Greenfoot.getRan domNumber(int limit) Return a random number between 0 (inclusive) and limit (exclusive). i want to control the direction in which the bullet flys with the arrow keys. The method is called isKeyDown and is part of the Greenfoot class. Plays the sound le named pop.wav if it is located in the sounds folder created for the Scenario. Greenfoot allows us to determine if particular keys are currently pressed. "1" will work, but only for the "1" above the letter keys (not for the numberic you got it right: "enter" aySound (pop.wav) Supported le types: AIFF, AU and WAV.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |