speed
GameMaker

Geschwindigkeitsanzeige für das Player Objekt

CreateEvent des Player Objekts:

nitroFuel = 10;
currentNitro = false;
nitroSpeedtimer = 0;
startMaxSpeed = 16;
maxSpeed = 16;
minSpeed = -1;
speed = 0.1;

DrawEvent des Player Objekts:

scr_interface_speed(obj_player.speed, 200, 1.5);

Script scr_interface_speed:

{
var playerSpeed = argument0;
var y1 = view_yview[4] + view_hview[4] – argument1;
var scale = argument2;

var x1 = (view_xview[4] + (view_wview[4] / 2));
var speedPercent = round(
(100 / obj_player.startMaxSpeed) * obj_player.speed
)

draw_text(view_xview[4] + 400, view_yview[4] + view_hview[4] – 100, ‚Speed %‘ );
draw_text(view_xview[4] + 500, view_yview[4] + view_hview[4] – 100, string(speedPercent));

//draw_sprite_ext( spr_interface_Speed, speedPercent, x1, y1, scale, scale, 0, c_white, 0.8 );

if (speedPercent >= 109) {
speedPercent = 109;
}

draw_sprite_ext( spr_interface_Speed, speedPercent-1, x1, y1, scale, scale, 0, c_white, 0.8 );
draw_sprite_ext( spr_interface_nitro, obj_player.nitroFuel, x1, y1+100, scale, scale, 0, c_white, 0.8 );

draw_set_valign(fa_center);
draw_set_halign(fa_center);
draw_set_font(fnt_interface_speed);
draw_text(x1, y1, string(round(123.4*playerSpeed)));
draw_set_font(fnt_interface_weapon);
draw_set_halign(fa_left);

}

StepEvent Player Objekt (Nitro-Bereich)

if (kUp) {

 

// Nitro Start
if (nitroSpeedtimer <= 0) {
currentNitro = false;
}

if ((100 <= nitroSpeedtimer) && (currentNitro == true)) {
speed += 0.25
nitroSpeedtimer -= 1;
maxSpeed += 0.25
}

if ((100 >= nitroSpeedtimer) && (currentNitro == true)) {
speed -= 0.25
nitroSpeedtimer -= 1;
maxSpeed -= 0.25
}

if ((kShift) && (nitroFuel > 0) && (currentNitro == false)) {
nitroSpeedtimer = 200;
currentNitro = true;
nitroFuel–;
}
// Nitro ENDE

}

 

Download der aktuellen Version:
lorner-161019-03

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.


*