Diciembre 31, 2010, 12:45:19 PM Ultima modificación: Enero 05, 2011, 11:39:35 AM por eric610
Hola! tengo un juego que es de coches, sencillisimo porque estoy empezando y lo que quiero es que cuando llegue a la meta mi choche y gane se reinicie de nuevo y que en el score cuente como una vuelta, luego 2, 3, asi sucesivamente hasta que me maten.

?Como lo hago? Muchas Gracias! :GM8:

Puedes no reiniciar todo el juego, solo una Room, y el score ser?a una variable global por lo que no se reiniciar?a.

O bien (si es necesario reiniciar el juego) una vez que termines la carrera guardes el valor del score en un archivo.ini, reinicies el juego y cargues el valor que acabas de guardar en el archivo.  ;)

Cuando llegues a la meta puedes mover tu coche a la posici?n donde empez? la carrera... as? no pierdes variables ni score

cuando terminen las vueltas
pones
[gml]
if score = "vueltas"
score = 0
game_restart()
[/gml]
Hola de nuevo

Muchas Gracias por vuestra ayuda, pero soy novato. Podriais si no es mucho trabajo explicarmelo paso a paso para que pueda hacerlo y asi aprenderlo?
muchas gracias! :GM8:

Imag?nate que el juego consta de 4 vueltas, en el objeto del auto que manejas en evento create v? a la pesta?a score y arrastra el "piece of code" y escribe vueltas=1 luego cuando dicho objeto d? la primera vuelta repite los pasos y escribe vueltas+=1 y por ?ltimo en el evento step vuelve a colocar el "piece of code" y escribe if vueltas=4 {room_restart} algo as? deber?a funcionar.

Ok!! Muchisimas Gracias!! ?Y tu sabes como poner mi Score dentro de la room? le pongo las coordenadas y todo pero no me sale.
Muchas Gracias de Nuevo

n.n Pod?s hacerlo con un "caption" v? a la pesta?a score y juego donde hay un icono con una s, una l y una h... Agrega eso en un evento create y recuerda: S=score(puntos) L=lives(vidas) H=health(salud) entonces deja el de score activo(mejor dicho no teques nada...) Esa es una forma m?s sencilla, y lo dibuja en la ventana. Hay otra que es escribiendolo a la vista: en la pesta?a score v? donde dice draw score y arrastralo en el evento draw de alg?n objeto invisible y que siempre est? en el juego(s? no hay crealo) donde dice caption(creo) le pon?s el nombre que quieras por ejemplo VUELTAS. Y donde dice x escribe: view_xview+32 y donde dice y: view_yview+2 despu?s acomodalo cambiando los n?meros(recuerda x= horizontal entre mayor sea el n?mero m?s a la derecha e y=vertical entre mayor sea m?s abajo) eso es todo.

Pues hice todo lo que me dijiste pero no me sale el Score. No se si estare haciendo algo mal. Lo que hice fue hacer un objeto sin imagen. en el evento Draw le arrastre el Draw Score y rellene como me dijiste (yo puse 400 en x y 16 en y). Luego fui a la room y pinche e la coordenada el objeto invisible pero no me sale.

?Que estoy haciendo mal?
muchisimas gracias.

Necesitamos m?s informaci?n.
Abr? el objeto auto, hac? click en Show Information, copi? todo lo que diga ah? y ponelo ac? as?:
[code*]ac? pon? el texto[/code*]
sacando los asteriscos.
Vim.

#10 Enero 03, 2011, 03:38:37 AM Ultima modificación: Enero 03, 2011, 03:40:42 AM por Masterkey
Recuerda agregarle el view_xview y view_yview *esto para que s? dibuje en la view(vista) y te siga. Adem?s el objeto que lo dibuja(el invisible) no es necesario que est? en esas coordenadas, col?calo donde sea. Deber?a funcionar. Edito: si no hac? lo que dice wadk.


Information about object: object0

Sprite: sprite0
Solid: true
Visible: false
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Collision Event with object object1:
start moving in directions 000000000 with speed set to 0
______________________________________________________

Information about object: object1

Sprite: sprite4
Solid: true
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
play sound phantoms; looping: true
set the health to 100

Collision Event with object object4:
bounce not precisely against solid objects

Collision Event with object object5:
bounce not precisely against solid objects
set the health relative to -10

Collision Event with object object6:
jump to the start position

Collision Event with object object7:
jump to the start position

Collision Event with object object8:
jump to the start position

Collision Event with object object9:
start moving in directions 000000000 with speed set to 0
set the health relative to -5

Collision Event with object object10:
start moving in directions 000000000 with speed set to 0
set the health relative to -5

Collision Event with object object11:
start moving in directions 000000000 with speed set to 0
set the health relative to -5

Collision Event with object object12:
start moving in directions 000000000 with speed set to 0
set the health relative to -5

Collision Event with object object13:
start moving in directions 000000000 with speed set to 0
set the health relative to -5

Collision Event with object object14:
start moving in directions 000000000 with speed set to 0
set the health relative to -5

Collision Event with object object17:
start moving in directions 000000000 with speed set to 0
set the health relative to -5

Collision Event with object object18:
start moving in directions 000000000 with speed set to 0
set the health relative to -5

Collision Event with object object19:
start moving in directions 000000000 with speed set to 0
set the health relative to -5

Collision Event with object object20:
start moving in directions 000000000 with speed set to 0
set the health relative to -5

Collision Event with object Police:
stop sound coche1
stop sound phantoms
show the video in file video/perder2.wmv  0
restart the game

Collision Event with object meta:
stop sound coche1
stop sound phantoms
show the video in file video/fin.wmv  0
go to room menu with transition effect Blend

Collision Event with object object44:
start moving in directions 000000000 with speed set to 0
set the health relative to -5

Collision Event with object object45:
start moving in directions 000000000 with speed set to 0
set the health relative to -5

Collision Event with object object46parado:
start moving in directions 000000000 with speed set to 0
set the health relative to -5

Collision Event with object object47parado:
start moving in directions 000000000 with speed set to 0
set the health relative to -5

Collision Event with object object48parado:
start moving in directions 000000000 with speed set to 0
set the health relative to -5

Keyboard Event for <Left> Key:
start moving in directions 000100000 with speed set to 2.7
set the sprite to sprite3 with subimage 0 and speed 3

Keyboard Event for <Up> Key:
start moving in directions 000000010 with speed set to 2.7
set the sprite to sprite1 with subimage 0 and speed 3

Keyboard Event for <Right> Key:
start moving in directions 000001000 with speed set to 2.7
set the sprite to sprite4 with subimage 0 and speed 3

Keyboard Event for <Down> Key:
start moving in directions 010000000 with speed set to 2.7
set the sprite to sprite2 with subimage 0 and speed 3

Other Event: No More Health:
sleep 1000 milliseconds; redrawing the screen: true
stop sound phantoms
stop sound coche1
show the video in file video/perder1.wmv  0
restart the game
______________________________________________________

Information about object: object3

Sprite: sprite8
Solid: true
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
set the relative path to Cocherojo with speed 1.3 and at the end stop

Step Event:
execute code:

if direction<45 and direction>-45  //derecha
{
sprite_index=sprite8
}
else
if direction>45 and direction<135 //arriba
{
sprite_index=sprite6
}
else
if direction>135 and direction<225 //izquierda
{
sprite_index=sprite7
}
else
if direction>225 and direction<315 //abajo
{
sprite_index=sprite9
}

______________________________________________________

Information about object: object4

Sprite: sprite13
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
set the relative path to Cochegris with speed 1.7 and at the end stop
play sound coche1; looping: true

Step Event:
execute code:

if direction<45 and direction>-45  //derecha
{
sprite_index=sprite13
}
else
if direction>45 and direction<135 //arriba
{
sprite_index=sprite12
}
else
if direction>135 and direction<225 //izquierda
{
sprite_index=sprite11
}
else
if direction>225 and direction<315 //abajo
{
sprite_index=sprite10
}


Collision Event with object meta:
stop sound coche1
stop sound phantoms
show the video in file video/perder1.wmv  0
restart the game
______________________________________________________

Information about object: object5

Sprite: sprite16
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
set the relative path to Cochetransam with speed 1.45 and at the end stop

Step Event:
execute code:

if direction<45 and direction>-45  //derecha
{
sprite_index=sprite16
}
else
if direction>45 and direction<135 //arriba
{
sprite_index=sprite14
}
else
if direction>135 and direction<225 //izquierda
{
sprite_index=sprite17
}
else
if direction>225 and direction<315 //abajo
{
sprite_index=sprite18
}


Collision Event with object meta:
stop sound coche1
stop sound phantoms
show the video in file video/perder1.wmv  0
restart the game
______________________________________________________

Information about object: object6

Sprite: sprite19
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
set the relative path to Camionxoto with speed 2 and at the end continue from start
______________________________________________________

Information about object: object7

Sprite: sprite20
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
set the relative path to Camionalba with speed 2 and at the end continue from start
______________________________________________________

Information about object: object8

Sprite: sprite21
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
set the relative path to Camionhercules with speed 1 and at the end continue from start
______________________________________________________

Information about object: object9

Sprite: sprite22
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
set the relative path to CocheNormal9 with speed 0.7 and at the end continue from start
______________________________________________________

Information about object: object10

Sprite: sprite22
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
set the relative path to Cochenormal10 with speed 1 and at the end continue from start
______________________________________________________

Information about object: object11

Sprite: sprite22
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
set the relative path to Cochenormal11 with speed 1.5 and at the end continue from start
______________________________________________________

Information about object: object12

Sprite: sprite22
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
set the relative path to Cochenormal12 with speed 1 and at the end continue from start
______________________________________________________

Information about object: object13

Sprite: sprite22
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
set the relative path to Cochenormal13 with speed 1 and at the end continue from start
______________________________________________________

Information about object: object14

Sprite: sprite22
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
set the relative path to Cochenormal14 with speed 0.5 and at the end continue from start
______________________________________________________

Information about object: object17

Sprite: sprite23
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
set the relative path to cochenormal17 with speed 1 and at the end continue from start
______________________________________________________

Information about object: object18

Sprite: sprite24
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
set the relative path to Cochenormal18 with speed 1 and at the end continue from start
______________________________________________________

Information about object: object19

Sprite: sprite23
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
set the relative path to Cochenormal19 with speed 1 and at the end continue from start
______________________________________________________

Information about object: object20

Sprite: sprite24
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
set the relative path to Cochenormal20 with speed 1 and at the end continue from start
______________________________________________________

Information about object: Energia

Sprite: <no sprite>
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Draw Event:
draw the health bar with relative size (0,0,128,16) with back color none and bar color green to red
______________________________________________________

Information about object: buttonjugar1

Sprite: sprite26
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Mouse Event for Left Button:
set the sprite to sprite25 with subimage 0 and speed 3
stop sound Menu
go to room room1 with transition effect Blend
______________________________________________________

Information about object: buttonsalir1

Sprite: sprite28
Solid: true
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Mouse Event for Left Button:
set the sprite to sprite27 with subimage 0 and speed 1
end the game
______________________________________________________

Information about object: buttonhistoria1

Sprite: sprite30
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Mouse Event for Left Pressed:
set the sprite to sprite29 with subimage 0 and speed 1
go to room Historia with transition effect Blend
______________________________________________________

Information about object: buttonobjetivo1

Sprite: sprite32
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Mouse Event for Left Button:
set the sprite to sprite31 with subimage 0 and speed 1
go to room Objetivo with transition effect Blend
______________________________________________________

Information about object: buttoncontroles1

Sprite: sprite34
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Mouse Event for Left Button:
set the sprite to sprite33 with subimage 0 and speed 1
go to room Controles with transition effect Blend
______________________________________________________

Information about object: buttoncreditos1

Sprite: sprite36
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Mouse Event for Left Button:
set the sprite to sprite35 with subimage 0 and speed 1
go to room Creditos with transition effect Blend
______________________________________________________

Information about object: buttonmakina1

Sprite: sprite40
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Mouse Event for Left Button:
stop sound Menu
show the video in file video/lv1.wmv  0
______________________________________________________

Information about object: buttonmenu

Sprite: sprite43
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Mouse Event for Left Button:
set the sprite to sprite42 with subimage 0 and speed 1
go to room menu2 with transition effect Blend
______________________________________________________

Information about object: musicamenu

Sprite: <no sprite>
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
play sound Menu; looping: true
______________________________________________________

Information about object: video

Sprite: <no sprite>
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
stop sound Menu
show the video in file video/lv1.wmv  0
______________________________________________________

Information about object: Police

Sprite: sprite47
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
set the relative path to cochepolicia with speed 1.6 and at the end continue from start
play sound coche1; looping: true

Step Event:
execute code:

if direction<45 and direction>-45  //derecha
{
sprite_index=sprite47
}
else
if direction>45 and direction<135 //arriba
{
sprite_index=sprite44
}
else
if direction>135 and direction<225 //izquierda
{
sprite_index=sprite46
}
else
if direction>225 and direction<315 //abajo
{
sprite_index=sprite45
}

______________________________________________________

Information about object: meta

Sprite: meta
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>
______________________________________________________

Information about object: object44

Sprite: sprite50
Solid: true
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
set the relative path to Cochenormal44 with speed 1 and at the end continue from start
______________________________________________________

Information about object: object45

Sprite: sprite50
Solid: true
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
set the relative path to cochenormal45 with speed 1 and at the end continue from start
______________________________________________________

Information about object: object46parado

Sprite: sprite24
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>
______________________________________________________

Information about object: object47parado

Sprite: sprite23
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>
______________________________________________________

Information about object: object48parado

Sprite: sprite22
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>
______________________________________________________






?cual es el objeto que dibuja el score?

Ay! perdona, te puse la info del coche.

te pongo la info del score.



Information about object: Score

Sprite: score
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Draw Event:
at position (view_xview+400 ,view_yview+16) draw the value of score with caption Score:



Una preguntita: Cuanto mide la view del room ???? ???