ich habe hier eine kleine sinus/cosinus-spielerei im 1024x768-raum. Der Code besteht eigentlich nur aus folgendem Skript:
Alles anzeigen
wenn man daraus allerdings eine exe macht, wird die erschreckend gross.
die frage deshalb: geht das denn nicht auch viel kleiner?
Quellcode
- resultat=100
- winkel = 45
- x0 = room_width/2
- y0 = room_height/2
- endlos = true;
- while (endlos) = true
- { screen_refresh()
- io_handle()
- if keyboard_check_direct(vk_up ) {resultat =resultat+1;if resultat >room_height/2 resultat = room_height/2}
- if keyboard_check_direct(vk_down ) {resultat =resultat-1;if resultat < 20 resultat = 20 }
- if keyboard_check_direct(vk_left ) {winkel =winkel -1;if winkel < 0 winkel = winkel+360}
- if keyboard_check_direct(vk_right ) {winkel =winkel +1;if winkel >=360 winkel = winkel-360}
- if keyboard_check (vk_escape) {endlos =false ;keyboard_clear(vk_escape) }
- io_clear()
- dwinkel = degtorad(winkel) // deg ree zu rad ian(Bogengrad).
- xanteil = sin(dwinkel)
- yanteil = cos(dwinkel)
- istx = xanteil * resultat
- isty = yanteil * resultat
- resultatx = x0 + istx
- resultaty = y0 + isty
- pen_size = 1
- action_fill_color(c_yellow)
- pen_color = c_yellow
- draw_rectangle(0,0,room_width,room_height)
- action_fill_color(c_blue )
- pen_color = make_color_rgb(0,0,128)
- draw_circle (x0,y0,resultat)
- font_size = 8
- font_style = fs_normal
- pen_size = 3
- pen_color = c_green
- draw_line(x0,y0,resultatx,resultaty)
- font_color = c_green
- draw_text(resultatx,resultaty,"Resultat "+ string(resultat))
- if istx < 0 pen_color = c_red else pen_color = c_black
- draw_line(x0,y0,resultatx,y0)
- if isty < 0 pen_color = c_red else pen_color = c_black
- draw_line(x0,y0,x0,resultaty)
- font_color = c_white
- draw_text(resultatx,y0,"x "+ string(round(istx)))
- draw_text(x0,resultaty,"y "+ string(round(isty)))
- font_color = make_color_rgb(255,0,128)
- font_size = 12
- font_style = fs_bold
- draw_text(20,room_height-40,"Winkel: "+ string(round(winkel))+" Sin: "+ string(round(100*sin(dwinkel))/100)+ " Cos: "+ string(round(100*cos(dwinkel))/100))
- draw_text( 20,30,"+/- Resultat: ")
- draw_text( 20,60,"+/- Winkel: ")
- draw_text(160,30,"Cursor ho/ru")
- draw_text(160,60,"Cursor re/li")
- }
- game_end()
wenn man daraus allerdings eine exe macht, wird die erschreckend gross.
die frage deshalb: geht das denn nicht auch viel kleiner?
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von -jc- ()