event: key left pressed action: instance_create

Discussion in 'Programming' started by makis2404, Mar 11, 2019.

  1. makis2404

    makis2404 Member

    Joined:
    Feb 10, 2019
    Posts:
    9
    Creates instances if only there is already an isntance in the scene. When instance goes out of room and gets instance destroy, cant create new instances.
    for examble: event create: speed = 3 , event key left pressed: instance_create_layer(40,50,"Instances", obj_vehicle), event outside room: instance_destroy(); if the firs instance goes out of room and is destroyed then pressing the left arrow key does not creates an instance.
     
  2. chamaeleon

    chamaeleon Member

    Joined:
    Jun 21, 2016
    Posts:
    975
    How much of the manual have you read so far?
     
  3. TsukaYuriko

    TsukaYuriko Q&A Spawn Camper Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    1,632
    If there is no instance in the room, what is going to create more instances, or even respond to key presses in the first place?
     
  4. IndianaBones

    IndianaBones Member

    Joined:
    Jul 5, 2016
    Posts:
    2,213
    Create a seperate controller object that stays in the room and checks for key presses and does the instance creation code. Don't assign a sprite to it so it won't be drawn in the game.
     
    makis2404 likes this.
  5. makis2404

    makis2404 Member

    Joined:
    Feb 10, 2019
    Posts:
    9
    Thanks mr. IndianaBones.
    Manual is a good place for reference, not a good tutorial.

    Can you make something more friendly than manual?
    Can you give give an answer instead of "advices" like that?
     
    Last edited by a moderator: Mar 31, 2019

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice