Replace the code in the
objBall Step event with the following:
1. Interchange functions and keys - how do these changes affect the behaviour of the controls?
if (keyboard_check(ord("A"))){
x = x - 3;
}
if (keyboard_check_pressed(vk_right)){
x = x + 3;
}
if (keyboard_check_released(vk_up)){
y = y - 3;
}
if (keyboard_check(vk_down)){
y = y + 3;
}
2. Working with the keyboard variables using a switch case expression - try this and decide which method you prefer.
switch (keyboard_key) {
case vk_numpad2: y = y + 3; break;
case vk_numpad4: x = x - 3; break;
case vk_numpad6: x = x + 3; break;
case vk_numpad8: y = y - 3; break;
}
3. Try mouse control - can you get this to work without the mouse click (i.e. follow the cursor in the room?)
if (mouse_check_button(mb_any)) {
direction = point_direction(x,y,mouse_x,mouse_y);
speed = 3;
}