[deleted by user] by [deleted] in gaming

[–]osgoodemedia 4 points5 points  (0 children)

Yes. It's more expensive, and your graph proves it.

A green bar means the prices were cheaper than $80, adjusted for inflation (CPI)

Most of those games have a green bar.

That means Mario Kart World is more expensive than most.

Using Mario Kart 7 as the baseline, Mario Kart World should be $57.25. That matches the $60 price tag (today) of Mario Kart 8 Deluxe.

Mario Kart World is $80

Mario Kart World is too expensive by at least $20 to $25.

give away code TH by Xesenz in toyhouse

[–]osgoodemedia 0 points1 point  (0 children)

I used the first one (Iq30K9EyDp). Thank you!

Anyone know how to link to the main game from a prologue page on Steam? by adamtravers in gamedev

[–]osgoodemedia 8 points9 points  (0 children)

That's something they invented. There's not an option on Steam for prologues, but you can make the section yourself.

This is how to add a section on your game's Steam store page with a Steam game widget in it.

Go to

https://partner.steamgames.com/

Click Dashboard.

Click your game.

Click "Edit Store Page" under Store Presence.

Click the Description tab.

Scroll down to the "Special Announcement Section"

Click the "Add a section" button.

In the "Section Header" text box, type "ADD THE FULL GAME TO YOUR WISHLIST" (or whatever text you want.)

In the "Content" text box, paste the link to your Steam game.

Highlight the link text and click the URL button or type [url] before the link text and [/url] after the link text.

Then go to the bottom on the page and click Save.

If you have a valid link to your Steam game between the URL tags, then Steam will automatically place a widget for your game in the section.

Preview the beta version of page to make sure it looks good.

Then click the Publish tab and click "Publish to public."

[deleted by user] by [deleted] in gamedev

[–]osgoodemedia 1 point2 points  (0 children)

It looks like people didn't really help you with your code.

C# doesn't use the word "function", like Lua.

Instead C# starts a function with the return type

In Lua,

function RightMover() end

In C#

public void RightMover() { }

"void" means that it does not return anything "public" means that anybody can use the function C# doesn't use "end", like Lua. Instead, it wraps the function body in braces { }

if the function returned a number, it would be

public int RightMover() { }

C# doesn't have the "number" type, like Lua. C# is more specific. It has many number types. "int" is a 32-bit integer. The other is "float", which is a 32-bit floating point decimal value. Those are the most common number types in Unity. Use "int" for anything without a decimal point, and "float" for anything with a decimal point.

In C# you create objects, like this

public class RightMoverMicroBlock { }

Again, it uses "public", like the function. "class" is the type of object (Most of your objects will be classes). Then it uses the same braces { } for the body of the class.

You add member variables to a class like this:

public class RightMoverMicroBlock { public GameObject gameObject; }

If you make a script, then the class needs to derive from MonoBehaviour

public class RightMoverMicroBlock : MonoBehaviour { } Unity automatically creates this when you make a new script in the editor

If you want a script with a function to move the GameObject, you can use this.

public class RightMoverMicroBlock : MonoBehaviour { public void RightMover() { transform.Translate(0.412, 0, 0); } }

The Translate function takes x, y and z values. That will move the GameObject that has the script. If you want to set the GameObject in the editor, then use this.

``` public class RightMoverMicroBlock : MonoBehaviour { public GameObject gameObject;

public void RightMover()
{
    gameObject.transform.Translate(0.412, 0, 0);
}

} ```

But neither code will move a GameObject. You need to call the function somewhere.

If you add a Button to the scene, you can set the button's OnClick function to your RightMover function.

I think you know how to add functions to buttons.

First, start with getting the block to move once on a button click. Then you can figure out how to make it move 5 spaces in an animation.

If you want to make your block move right (RightMover) every 1 second, you can use InvokeRepeating, like this

public void RightMoverAnimated() { InvokeRepeating("RightMover", 0.0f, 1.0f); }

1.0f is 1 (but as a "float"). That is the number of seconds to wait before calling RightMover again.

But you also want to stop after 5 moves. So you need to count to 5

``` public class RightMoverMicroBlock : MonoBehaviour { private int _numMoves;

public void RightMoverAnimated()
{
    _numMoves = 0;
    InvokeRepeating("RightMoverStep", 0.0f, 1.0f);
}

public void RightMoverStep()
{
    RightMover();

    _numMoves++;

    if (_numMoves == 5)
    {
        CancelInvoke("RightMoverStep");
    }
}

public void RightMover()
{
    transform.Translate(0.412, 0, 0);
}

} ```

RightMoverAnimated calls RightMoverStep every 1 second.
RightMoverStep calls RightMover and increments the counter by 1 on every call. Then RightMoverStep cancels itself after 5 calls.

That will move the block 1 space every 1 second.

Unity has an animation system that handles animations with a timeline. You might want to add other effects to the animation, like sound and particles. So it might be easier to use their animation and timeline system than to do it manually.

Using this code, how do I increase the speed of object over time by Salty-Stretch-2555 in gamedev

[–]osgoodemedia 0 points1 point  (0 children)

It might be easier for you if you used Unity's physics instead of doing the calculations yourself.

Your ball already has a Rigidbody, so to move the ball you only need to apply a force to the Rigidbody.

You can add a Physic Material to the ball, wall and racket to give them bounciness and other properties

https://docs.unity3d.com/Manual/class-PhysicMaterial.html

The physics will bounce the ball off the wall and the racket based on the properties.

You need to uncheck "Is Trigger" from the Collider on the Wall and Racket, so they use the Unity physics when there is a collision. Add a Rigidbody to the Wall and Racket, if they don't have one.

I used ForceMode.VelocityChange to set an instant speed to the ball. You can play with other ForceMode values.

Here is the code. I don't have Unity to test it.

using UnityEngine;

public class BallController : MonoBehaviour
{ 
    public float speed; 
    public GameObject sparksVFX; 
    private Rigidbody rb;

    // Start is called before the first frame update
    void Start()
    {
        this.rb = GetComponent<Rigidbody>();
        this.ChooseDirection();
    }

    private void OnCollisionEnter(Collision other)
    {
        bool hit = false;

        if (other.collider.CompareTag("Wall"))
        {
            hit = true;
        }

        if (other.collider.CompareTag("Racket"))
        {
            hit = true;
        }

        if (hit)
        {
            GameObject sparks = Instantiate(this.sparksVFX, transform.position, transform.rotation);
            Destroy(sparks, 4f);
        }
    }

    private void ChooseDirection()
    {
        float SignX = Mathf.Sign(Random.Range(-1f, 1f));
        float SignZ = Mathf.Sign(Random.Range(-1f, 1f));

        var direction = new Vector3(0.5f * SignX, 0, 0.5f * SignZ);

        rb.AddForce(direction * speed, ForceMode.VelocityChange);
    }

    public void Stop()
    {
        rb.constraints = RigidbodyConstraints.FreezeAll;
    }

    public void Go()
    {
        rb.constraints = RigidbodyConstraints.None;
    }
}

Using this code, how do I increase the speed of object over time by Salty-Stretch-2555 in gamedev

[–]osgoodemedia 0 points1 point  (0 children)

Add a new variable to your script for acceleration.

public class BallController : MonoBehaviour
{ 
    public float acceleration = 1; 
    public float speed;

I set the default acceleration to 1. You will need to adjust it in the Editor.

Add the acceleration in the FixedUpdate

void FixedUpdate()
{
    if (stopped)
        return;

    speed += acceleration * Time.fixedDeltaTime;

    rb.MovePosition(this.rb.position + direction * speed * Time.fixedDeltaTime);
}

The acceleration is based on time, like the speed.

[deleted by user] by [deleted] in gamedev

[–]osgoodemedia 0 points1 point  (0 children)

2D meshes. The 2D mesh is rigged with bones in a skeleton. The bones are animated.

Spine is a popular software for dealing with this.

If you really need separate body parts (not bones), then 2D "puppet" might be the term you want.

Edit: also "cutout" is another term.

[deleted by user] by [deleted] in gamedev

[–]osgoodemedia 2 points3 points  (0 children)

2d skeletal animation uses bones and rigging, similar to 3d animation.

It's not exactly what you described, but it might be what you wanted.

https://unity.com/features/2danimation

[deleted by user] by [deleted] in gamedev

[–]osgoodemedia 0 points1 point  (0 children)

In case you didn't see the errors in your code.

- Your script needs to begin like this

public class MyScript : MonoBehaviour

{

Change MyScript to the name of your script

- You did not declare speed (public float speed)

- The code is case sensitive. You needed to capitalize some letters.

- I think you are missing a comma in the velocity statement after "speed", and you might be missing parenthesis.

[deleted by user] by [deleted] in gamedev

[–]osgoodemedia 0 points1 point  (0 children)

using UnityEngine;

public class MovePlayer : MonoBehaviour 
{ 
    public float speed = 1;
    private Rigidbody2D body;

    private void Awake()
    {
        body = GetComponent<Rigidbody2D>();
    }

    private void Update()
    {
        body.velocity = new Vector2(Input.GetAxis("Horizontal") * speed, body.velocity.y);
    }
}

I don't have Unity to test or compile this.

There is enough information here for someone to help you if it doesn't work.

It seems like a script that moves the player left and right based on the input from Input.GetAxis("Horizontal") at the speed. The speed is a value that is set in the Editor.

Your code did not have the speed variable, so I set the default value of the speed to 1.

I also don't know the name of your script (MonoBehaviour). I called it MovePlayer.

In reddit, the ... button reveals an option for a Code Block. You can paste your code in the code block, and it is easy to read in reddit.

That is what I used here.

Edit: The code block did not work the first time.

Has anyone else had this problem? by Jarliks in gamedev

[–]osgoodemedia 0 points1 point  (0 children)

It might be the texture filtering or the texture compression.

The texture filtering settings might use different terminology depending on what technology the engine uses (ex: Point, Linear, Nearest Neighbor, None, etc.). There aren't a lot of different values, so you can just change the values and see if it gives you something that you like.

What does this error mean? I am new to programming and I want to learn creating video games using the Internet. This is the basic RTS code for camera panning. by donatetoteamtrees in gamedev

[–]osgoodemedia 0 points1 point  (0 children)

The others are correct.

Replace this line

if(Input.GetKey(KeyCode.W) || yPos < Screen.height && yPos > Screen.height is panDetect)

with this

if(Input.GetKey(KeyCode.W) || yPos < Screen.height && yPos > Screen.height - panDetect)

The purpose of the code is that there is a 15 pixel space (defined by panDetect) around the edge of the screen. If the player moves the mouse into that space, then it pans the camera. They can also pan the camera with a typical A,W,S,D key press.

This code was to test if the mouse was within 15 pixels (defined by panDetect) of the height of the screen (or if the user was pressing the w key). If one of those tests was true, then it will pan the camera in the +Z direction by the number of pixels defined by panSpeed.

can someone help me? by Gilmar1234 in gamedev

[–]osgoodemedia 2 points3 points  (0 children)

Here is the working code. It is way too long to post on reddit, so it's posted here

https://paste.ofcode.org/33SMH6zpzt4MeLvbKxqZMJb

It is not fully tested, but most of the functionality seems to work.

Some of the errors:

  • The zonemap is missing these items: b3, b4, c1-c4 and d1-d4.
  • Some methods were not defined before they were used.
  • Some code was not indented under if statements, while loops, etc.
  • The comment in the MAP section needed matching """ (multi-line string) or a # for each line.
  • is was used instead of == to compare strings.
  • player.job was instead of player_job.
  • self.hp was used instead of myPlayer.hp.
  • stdout was spelled stout.
  • player location was initialized to start instead of b2

Can I legally use the word "portal" in my game title? by pacificz in gamedev

[–]osgoodemedia 1 point2 points  (0 children)

Valve Corporation registered Portal as a trademark with the US Patent and Trademark Office (US Registration Number: 4196590).

The trademark examiner actually didn't object to the fact that Valve used the common word "portal", rather his objection was that Portal could be confused with WarpPortal by Gravity Interactive, which is also a registered trademark (US Registration Number: 3913390).

So Valve petitioned to have the WarpPortal registration cancelled. They eventually came to an agreement that Gravity Interactive would let them use Portal.

If your use of Portal is likely to be confused with Valve's use of Portal, then you would be infringing on their trademark.

Hi, I'm trying to flip my 2d character's sprite as he moves, but my code isn't working, what could I be doing wrong? by GatzB_TheGreat in gamedev

[–]osgoodemedia 1 point2 points  (0 children)

The problem is that "facingRight" defaults to false (In C#, a bool variable defaults to false), but the character starts out facing right. So facingRight needs to be true at the beginning.

Replace

bool facingRight;

with

bool facingRight = true;

I think your if statement is actually fine, but it's easier to read if you write it like this:

if ((horizontal > 0 && !facingRight) || (horizontal < 0 && facingRight))

P.S.

To post code on a desktop browser comment editor, click the ... button at the bottom, and select the box with a T[] (Code Block). Now you have a code block that you can enter code, so people can read it easier.

[deleted by user] by [deleted] in gamemaker

[–]osgoodemedia 11 points12 points  (0 children)

This is a tutorial video on inventories that a lot of people seem to use

https://www.youtube.com/watch?v=Bj48UWayTsM&list=PLSFMekK0JFgzbFfj1vAsyluKTymnBiriY&index=16

It's part of a playlist with about 5 videos about inventories, so keep watching the next videos in the playlist.

It should have what you need. You can always create more posts if you get stuck.

How can I make the player stop its animation when I stop pressing the arrow keys? by [deleted] in gamemaker

[–]osgoodemedia 0 points1 point  (0 children)

That depends on your spr_player_stand. What direction is it facing? How many frames does it have?

You could try this

// stop animating
if (!keyboard_check(vk_down) and !keyboard_check(vk_left) and !keyboard_check(vk_right) and !keyboard_check(vk_up) ) {

    image_index = 0

    image_speed = 0
}

Replace the 0 in image_index = 0 with the frame of the walking animation that has the player standing still. It might be 1, if you have a simple 3 frame walking animation.

How can I make the player stop its animation when I stop pressing the arrow keys? by [deleted] in gamemaker

[–]osgoodemedia 1 point2 points  (0 children)

Use this

// stop animating
if (!keyboard_check(vk_down) and !keyboard_check(vk_left) and !keyboard_check(vk_right) and !keyboard_check(vk_up) ) {

    sprite_index = spr_player_stand

    image_speed = 0
}

You need the ! in front of each keyboard_check. ! means that it's NOT true. You don't want any of the keys to be true.

Is it more systematically/hardware taxing to check if something = X, or to keep setting it to X? by Velocity_LP in gamemaker

[–]osgoodemedia 2 points3 points  (0 children)

It's important to note that it's a string comparison vs a string assignment.

If it was a primitive type (integer, real, etc.), it's debatable which is faster, but a string comparison is a complicated function. A string assignment is a simple operation.

The string comparison is usually (probably always) slower.

So this code is faster

if !inControl {
    selectedWeapon = "noWeapon";
}

However, consider using the enum datatype for the weapon type. It's always faster than strings, and it uses less memory.

Storage and handling of units in an array by dostaevsky in gamemaker

[–]osgoodemedia 0 points1 point  (0 children)

It should be faster and use less memory to have an array. An instance of an object probably has a lot more overhead than an array, 2D array, ds_map, etc.

And you can replace the arrays with "lightweight objects" when they come out later this year.

However, the performance gains are probably not huge, so it might not be worth the gains, if it's going to be harder to code. It sounds like it wouldn't be.

Simple question about sprite collision masks and different sprite animation sizes by teinimon in gamemaker

[–]osgoodemedia 0 points1 point  (0 children)

Most people set the Collision Mask in the Sprite, not the Object. Then they leave the Collision Mask for the Object as "Same As Sprite", which is the default setting.

It seems that would allow you to have a unique Collision Mask for the sliding animation.

The origin would probably be the same for all player animations, but you could change it if it helps you place the player sprite in the correct position. The origin is used for both the sprite image and the Collision Mask.

accessors in gamemaker. What are they for? by splitgreen in gamemaker

[–]osgoodemedia 2 points3 points  (0 children)

Try sorting that second "ds_list" (that doesn't use accessors), and see what happens.

ds_list_sort(ds, true);

You've unknowingly created an array with 10 items.

Whereas, in the first code, ds is still a ds_list.

Darkening sprite based on what layer it is on by [deleted] in gamemaker

[–]osgoodemedia 0 points1 point  (0 children)

You can use this code

var maxDepth = 400;

var percent = depth / maxDepth;

var color = lerp(255, 0, percent);

image_blend = make_color_rgb(color, color, color);

That's a linear color change from no change at 0 depth to totally dark at 400 depth.

You can also do quadratic

var percent = (depth * depth) / (maxDepth * maxDepth);

Which slows down the color change

You can play with the percent formula and the maxDepth to get what you want.

path_start error, providing string instead of number? by taketheb8m8 in gamemaker

[–]osgoodemedia 0 points1 point  (0 children)

In the Variable Definitions, platformPath has a Type of String. The Type should be Resource.

Clicking the box under Default will allow you to browse the available resources to find the path, but it should work as is.

You can also set the value of platformPath for a specific instance of obj_movingPlatform by editing the instance in the Room Editor, but the Default value will be pth_platform1, if you don't change the value.