martes, 7 de mayo de 2024

GDScript, produce disparos con el mouse, rafagas de disparos girando la rueda del mouse; todo rafagas;para disparos de 1 en 1, solamente presionar 1-----if event.button_index == 1 and event.pressed :;

 extends Area3D


var Bullet = preload("res://PROYECTIL.tscn")


func _ready():


pass # Replace with function body.



func _input(event):



if event is InputEventMouseButton:


#if event.button_index == 1:

#if event.button_index == 1 and event.pressed == false:

var bullet = Bullet.instantiate()



add_child(bullet)


---------------------------------------------------------------------------

para disparos de 1 en 1, sin rafaga, sin que salgan 2 disparos al presionar 1 y soltar 1, solamente presionar 1---------------if event.button_index == 1 and event.pressed :

----------------------------------------------------------------------------

extends Area3D


var Bullet = preload("res://PROYECTIL.tscn")


func _ready():


pass # Replace with function body.



func _input(event):



if event is InputEventMouseButton:


if event.button_index == 1 and event.pressed :

#event.button_index == MOUSE_BUTTON_LEFT and event.pressed:

var bullet = Bullet.instantiate()



add_child(bullet)


------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------
al soltar la presion de la tecla del mouse....
--------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
extends Area3D

var Bullet = preload("res://PROYECTIL.tscn")

func _ready():

pass # Replace with function body.


func _input(event):


if event is InputEventMouseButton:

#if event.button_index == 1 and event.pressed :#AL,PRESIONAR
if event.button_index == 1 and not event.pressed :#AL SOLTAR
#event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
var bullet = Bullet.instantiate()


add_child(bullet)

domingo, 5 de mayo de 2024

GDScript; w-a-s-d y flechas teclado , girar y mover un cañon CharacterBody3D;ampliado alante atras izquierda derecha arriba y abajo inclinacion de cañon....!!!!;

 extends CharacterBody3D




var rotate_speed = 10.1 




const SPEED = 5.0

const JUMP_VELOCITY = 14.5


# Get the gravity from the project settings to be synced with RigidBody nodes.

var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")




func _ready(): 


pass # Replace with function body.


func _physics_process(delta):


if not is_on_floor():

velocity.y -= gravity * delta


# Handle jump.

if Input.is_action_just_pressed("ui_accept") and is_on_floor():

velocity.y = JUMP_VELOCITY


# Get the input direction and handle the movement/deceleration.

# As good practice, you should replace UI actions with custom gameplay actions.

#var input_dir = Input.get_vector("move_left", "move_right", "move_forward", "move_backward",)#PERFECTOOOOOOO

var input_dir = Input.get_vector("ui_left", "ui_right","A", "B",)# "A", "B" SOLO AMAGO PARA QUE NO BALLA ADELANTE A DETRAS

#var input_dir = Input.get_vector("A", "D", "W", "S")

var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()

if direction:

velocity.x = direction.x * SPEED

velocity.z = direction.z * SPEED

else:

velocity.x = move_toward(velocity.x, 0, SPEED)

velocity.z = move_toward(velocity.z, 0, SPEED)

move_and_slide()



var movimiento_vector = Vector3.ZERO  # Inicializar vector de movimiento


if Input.is_action_pressed("move_forward"):

rotate_x(0.01) # Mover en el eje X para rotar (negativo para abajo)

elif Input.is_action_pressed("move_backward"):

rotate_x(-0.01)   # Mover en el eje X para rotar (positivo para arriba)

elif Input.is_action_pressed("move_left"):

rotate_y(0.01)  # Mover en el eje Z para rotar (positivo para izquierda)

elif Input.is_action_pressed("move_right"):

rotate_y(-0.01) # Mover en el eje Z para rotar (negativo para derecha)


-------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------EXPLICACION: EN GODOT DESDE PROYECTO A CONFIGURACION PROYECTO SE HAN DE ASIGNAR LAS LETRAS move_left" SERIA LA -A-move_right" SERIA LA -D- Y ASI SUCESIVAMENTE, etc etc etc.....



-------------------------------------------------------------------------------------------------------------------------------

ampliado alante atras izquierda derecha arriba y abajo inclinacion de cañon....!!!!!!!!

--------------------------------------------------------------------------------------------------

extends CharacterBody3D




var rotate_speed = 10.1 




const SPEED = 5.0

const JUMP_VELOCITY = 14.5


# Get the gravity from the project settings to be synced with RigidBody nodes.

var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")




func _ready(): 


pass # Replace with function body.


func _physics_process(delta):


if not is_on_floor():

velocity.y -= gravity * delta


# Handle jump.

if Input.is_action_just_pressed("ui_accept") and is_on_floor():

velocity.y = JUMP_VELOCITY


# Get the input direction and handle the movement/deceleration.

# As good practice, you should replace UI actions with custom gameplay actions.

#var input_dir = Input.get_vector("move_left", "move_right", "move_forward", "move_backward",)#PERFECTOOOOOOO

var input_dir = Input.get_vector("ui_left", "ui_right","ui_up", "ui_down",)# "A", "B" SOLO AMAGO PARA QUE NO BALLA ADELANTE A DETRAS

#var input_dir = Input.get_vector("A", "D", "W", "S")

var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()

if direction:

velocity.x = direction.x * SPEED

velocity.z = direction.z * SPEED

else:

velocity.x = move_toward(velocity.x, 0, SPEED)

velocity.z = move_toward(velocity.z, 0, SPEED)

move_and_slide()



var movimiento_vector = Vector3.ZERO  # Inicializar vector de movimiento


if Input.is_action_pressed("move_forward"):

rotate_x(0.01) # Mover en el eje X para rotar (negativo para abajo)

elif Input.is_action_pressed("move_backward"):

rotate_x(-0.01)   # Mover en el eje X para rotar (positivo para arriba)

elif Input.is_action_pressed("move_left"):

rotate_y(0.01)  # Mover en el eje Z para rotar (positivo para izquierda)

elif Input.is_action_pressed("move_right"):

rotate_y(-0.01) # Mover en el eje Z para rotar (negativo para derecha)




jueves, 2 de mayo de 2024

script movimiento por teclas w-a-s-d y espacio, GDScript;

extends CharacterBody3D


#func _unhandled_input(event):


const SPEED = 5.0
const JUMP_VELOCITY = 14.5

# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")



func _ready(): 


   # if event is InputEventKey and event.pressed:
   # if event.keycode == KEY_A:


pass # Replace with function body.







func _physics_process(delta):

if not is_on_floor():
velocity.y -= gravity * delta

# Handle jump.
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
velocity.y = JUMP_VELOCITY

# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var input_dir = Input.get_vector("move_left", "move_right", "move_forward", "move_backward",)
#var input_dir = Input.get_vector("A", "D", "W", "S")
var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
if direction:
velocity.x = direction.x * SPEED
velocity.z = direction.z * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
velocity.z = move_toward(velocity.z, 0, SPEED)
move_and_slide()

-------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------EXPLICACION: EN GODOT DESDE PROYECTO A CONFIGURACION PROYECTO SE HAN DE ASIGNAR LAS LETRAS move_left" SERIA LA -A-move_right" SERIA LA -D- Y ASI SUCESIVAMENTE, SE PODRIA PONER SIMPLEMENTE "a" Y ASIGNAR LA "a" Y ASI SUCESIVAMENTE, PERO ESTA MONTADO ASI.............

domingo, 28 de abril de 2024

El Loco del Cruzero, demo de videojuego echo con Godot 4.2 3Dimensiones;

 

Captura en video de proximo videojuego que publicare en unos dias en Itchi.io al precio de 2$ , posiblemente consiga una o dos ventas y cerca de cien visitas el primer dia de su publicacion, bueno me refiero a las visitas a la ventas de una a cuatro semanas y no superara una o dos ventas, lo tengo experimentado.
Hace mucha ilusion de todas formas ganarse una calderilla. si se hacen juegos y se publican de forma razonable , sin abusar y siendo realista con lo que se hace no te vetan la cuenta de Itch.io, pero si haces el tonto se dan cuenta y te la bloquean.

Video capture of the next video game that I will publish in a few days on Itchi.io at the price of $2, possibly getting one or two sales and close to a hundred visits on the first day of its publication, well I mean the visits to the sales of one to four weeks and it will not exceed one or two sales, I have experienced it.
It's very exciting to earn a little money anyway. If you make games and publish them in a reasonable way, without abusing them and being realistic about what you do, they won't ban your Itch.io account, but if you act stupidly, they will notice and block it.

jueves, 25 de abril de 2024

GDScript metodo de entrada de teclado, al presionar "W" rota un MeshInstance3D;

 extends MeshInstance3D


func _unhandled_input(event):

if event.pressed and event.keycode == KEY_W:


rotate_y(10.33)


#$AudioStreamPlayer3D.play()

# Called when the node enters the scene tree for the first time.

func _ready():

pass # Replace with function body.



# Called every frame. 'delta' is the elapsed time since the previous frame.

func _process(delta):


pass

--------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------

EXPLICACION: Otro script que en teoria es corrcto pero me crea un conflicto con el resto de nodos y escenas de mi juego....e de estudiar que pasa........ como se ve en la captura de pantalla las flechitas azules de la izquierda indican que esta correcto....!!!!


Posible sonido al presionar espacio, para un Area3d con godot 4.2, si no existen otros sonidos; GDScript;

 extends Area3D




# Called when the node enters the scene tree for the first time.

func _ready():

if Input.is_action_pressed("ui_accept"):

$"AudioStreamPlayer3D SUENANSUSPASOS".play()

if Input.is_action_just_released("ui_accept"):

$"AudioStreamPlayer3D SUENANSUSPASOS".play()

pass # Replace with function body.



# Called every frame. 'delta' is the elapsed time since the previous frame.

func _process(delta):

#if Input.is_action_pressed("w"):


pass

--------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------
EXPLICACION: el script es correcto, pero si hay otras areas 3d y el juego empieza a estar cargado de otros sonidos y elementos es posible que entre en conflicto con el resto de nodos y escenas, que es lo que me esta pasando ahora con un juego que empieza a ser amplio, de todas formas como me sale correcto lo pongo en el blog por si se quieren hacer pruebas,,,,,,Tiene que ser correcto porque a si lo marcan las flechitas azules
Tiene que ser correcto porque a si lo marcan las flechitas azules......