Hi. Ich versuch derzeit das Jumpn Run Tutorial. Allerdings möchte ich es mit Code und nicht mit dem Drag an Drop machen.
Nun verstehe ich allerdings etwas einfach nicht... Es funktioniert zwar und ich habe es sogar gecodet (also zumindest das erste) und zwar so:
Alles anzeigen
Allerdings mein Problem ist eben. Ich verstehe das mit der Variable vspeed nicht wirklich... kann mir das jemand besser erklären als im Tutorial wie das funktioniert damit? Und ich verstehe ebenso den Befehl move in direction nicht, warum dieser hier eingesetzt wird.. Und wie würde man das in GML schreiben?
Nun verstehe ich allerdings etwas einfach nicht... Es funktioniert zwar und ich habe es sogar gecodet (also zumindest das erste) und zwar so:
GML-Quellcode
- Information about object: OBJ_Player
- Sprite: SPR_Char_1_Rechts_Still
- Solid: false
- Visible: true
- Depth: 0
- Persistent: false
- Parent: <no parent>
- Mask: <same as sprite>
- Create Event:
- execute code:
- HP = 100;
- image_speed = 0.25;
- Step Event:
- execute code:
- if (place_free(x,y+1))
- {
- gravity_direction = 270;
- gravity = 0.5;
- };
- else
- {
- gravity = 0;
- };
- if (vspeed > 12) vspeed = 12;
- Collision Event with object OBJ_Solid_16x16:
- move in direction direction at most 0 till a contact with solid objects
- set the vertical speed to 0
- Keyboard Event for <no key> Key:
- execute code:
- if (keyboard_lastkey = vk_left) sprite_index = SPR_Char_1_Links_Still;
- if (keyboard_lastkey = vk_right) sprite_index = SPR_Char_1_Rechts_Still;
- Keyboard Event for <Space> Key:
- execute code:
- if (place_free(x,y+1) = 0)
- {
- vspeed = -7;
- sound_play(sound1);
- }
- Keyboard Event for <Left> Key:
- execute code:
- if (place_free(x-3,y))
- {
- x -= 3;
- sprite_index = SPR_Char_1_Links;
- }
- Keyboard Event for <Right> Key:
- execute code:
- if (place_free(x+3,y))
- {
- x += 3;
- sprite_index = SPR_Char_1_Rechts;
- }
Allerdings mein Problem ist eben. Ich verstehe das mit der Variable vspeed nicht wirklich... kann mir das jemand besser erklären als im Tutorial wie das funktioniert damit? Und ich verstehe ebenso den Befehl move in direction nicht, warum dieser hier eingesetzt wird.. Und wie würde man das in GML schreiben?