Tag Archives: The game development

Unity Component.isActiveAndEnabled Analysis of exact meaning

The following results are the test conclusions.

Isactive in hierachy is equivalent to whether a GameObject is active or not, which is the same as a simple understanding.

Isactive andenabled requires three conditions:

The isactiveinheerachy of

    GameObject is true, and onenable
is being or has been called

So:

    in onenable of a script, isactive andenabled is always true. In ondisable of a script, isactive andenabled is always false

 

Test example: place a GameObject in the scene and two scripts below. Set GameObject and scripts to be active. In the process of running the scenario, in the script that calls onenable first, you can find that your isactive andenabled is true, but another script’s isactive andenabled is false.

So: there is no script to call onenable, though gameObject.isActiveInHierachy Is true, and enabled is true, but isactive andenabled is false.

 

Blender graphic tutorial: loop cut for polygon modeling commands

The polygon modeling command is only available under edit mode

this command is called Loop Cut and Slide short for Loop Cut shortcut key (Ctrl + R)


Blender loop cut operation design is very smooth. The basic steps are as follows:

    first press the shortcut key on the object to be looped Ctrl + R. At this time, different previews will be generated with different mouse positions. When previewing, scroll mouse wheel up and down to increase or decrease the number of ring cut edges, and the preview effect will also change accordingly (this step is optional). If you are satisfied with the preview, click the left mouse button. Slide the mouse to move the cut edge of the ring (optional). If you are satisfied with the preview, click the left mouse button again.

The whole process requires two left mouse clicks

Create game scene in unity_ Creating a beat em up game in unity

Create game scenes in Unity
Learn how to use Unity to create a 3D Beat Em Up game in this full tutorial from Awesome Tuts.
Learn how to create a 3D Beat Em Up game using Unity in the full tutorial on Awesome Tuts.
This tutorial covers everything you need to know to make a basic Beat Em Up game. You are even provided the 3D assets!
This tutorial covers everything you need to know to make a basic Beat Em Up game. You even get a 3D resource!
Here are the topics covered in the course:
The following topics are covered in this course:
According to the Animations, it is important to create a single Character Animation Script so that the players can’t Attack the shaping of Our Player To detect And deal with Damage to Character Animation Delegate Script, The Enemy Movement Script is configured to create Player Attack Points For Detecting And Dealing Damage to The Health Script Create healthy Script Knocking Down Enemy With Combos use combination Down Enemy Adding Sound FX In The Game In The Game To add Sound effects Camera Shake FX Camera vibration effect Enemy Attack Points And ‘Dealing Damage To Player attacking Enemy And The Enemy To The harm of The Player Manager Manager Script Script The Enemy Displaying the Health Stats With the UI using the UI display Health status
You can watch the full video on the freeCodeCamp.org YouTube Channel (4.5 Hour Watch).
You can watch the full video (4.5 hours) on the freeCodeCamp.org YouTube channel.

Translated from: https://www.freecodecamp.org/news/create-a-beat-em-up-game-in-unity/

Create game scenes in Unity

Apawn class, add axis mapping to control apawn movement

APawn class, add axis mapping to enable control of APawn movement
MyPawn.h

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Pawn.h"
#include "Components/StaticMeshComponent.h"
#include "Camera/CameraComponent.h"
#include "MyPawn.generated.h"

UCLASS()
class FIRSTDEMO_API AMyPawn : public APawn
{
	GENERATED_BODY()

public:
	// Sets default values for this pawn's properties
	AMyPawn();

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

public:	
	// Called every frame
	virtual void Tick(float DeltaTime) override;

	// Called to bind functionality to input
	virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

	UPROPERTY(VisibleAnywhere)
	UStaticMeshComponent* MyStaticMesh;

	UPROPERTY(VisibleAnywhere)
	UCameraComponent* MyCamera;

	UPROPERTY(EditAnywhere)
	float MaxSpeed;//add pawn movement speed parameter.

private:
	// add axis mapping function, MoveForward, MoveRight, Velocity
	//Set to private variables, handled in the Pawn class itself, no need to expose them to outsiders.
	void MoveForward(float Value);
	void MoveRight(float Value);
	FVector Velocity;

};

MyPawn.cpp

// Fill out your copyright notice in the Description page of Project Settings.


#include "MyPawn.h"
#include "Components/InputComponent.h"

// Sets default values
AMyPawn::AMyPawn()
{
 	// Set this pawn to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

	RootComponent=CreateDefaultSubobject<USceneComponent>(TEXT("RootComponent"));

	MyStaticMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("MyStaticMesh"));
	MyStaticMesh->SetupAttachment(GetRootComponent());

	MyCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("MyCamera"));
	MyCamera->SetupAttachment(GetRootComponent());

	MyCamera->SetRelativeLocation(FVector(-300.f, 0.f, 300.f));
	MyCamera->SetRelativeRotation(FRotator(-45.f, 0.f, 0.f));

	AutoPossessPlayer = EAutoReceiveInput::Player0;
	
	MaxSpeed = 100.f;
	Velocity = FVector::ZeroVector;

}

// Called when the game starts or when spawned
void AMyPawn::BeginPlay()
{
	Super::BeginPlay();
	
}

// Called every frame
void AMyPawn::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);
	//Add offset function to tick.
	AddActorLocalOffset(Velocity * DeltaTime, true);

}

// Called to bind functionality to input
void AMyPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
	Super::SetupPlayerInputComponent(PlayerInputComponent);
	
	// Bind player input to axis mapping, axis mapping and function name should correspond to each other
	PlayerInputComponent->BindAxis(TEXT("MoveForward"), this, &AMyPawn::MoveForward);
	PlayerInputComponent->BindAxis(TEXT("MoveRight"), this, &AMyPawn::MoveRight);

}

void AMyPawn::MoveForward(float Value)
{
	//Forward speed, use Clamp to limit value to -1,1, place too large a value in the Ue4 editor, resulting in a bug.
	Velocity.X = FMath::Clamp(Value, -1.f, 1.f) * MaxSpeed;
}

void AMyPawn::MoveRight(float Value)
{
	// Speed to the right, use Clamp to limit value to -1,1, place too large a value in the Ue4 editor, resulting in a bug.
	Velocity.Y = FMath::Clamp(Value, -1.f, 1.f) * MaxSpeed;
}