Questions tagged [objectinstantiation]

92 questions
0
votes
2 answers

Instantiating an object after updating a variable isn't working as expected

Let's say I have two scripts: SpawnManager Enemy In SpawnManager, I have the function SpawnEnemyWave that should instantiate 3 enemies, if the random number generator is lower than 5, then one of them should have a higher movement speed, the other…
Heijs7
  • 27
  • 6
0
votes
0 answers

Using dynamic binding to create an instance of a class which implements an interface

I'm implementing a board game for two players. Users are able to create their own AIs for the game and add them to the game. These AIs also can implement own, more efficient versions (data structures) of the board to save time when calculating the…
user19938273
0
votes
1 answer

Hod to do multiple instance of QTcpSocket objects for multiple connections to different servers?

i'm quite starting OOP so i can make incredible stupid things. Anyway. I've got 2 cameras (or 4) witch own their tcp server for providing MJPEG video stream. on one base computer i need to handle 2 (or 4) tcp client connections to these units. if i…
0
votes
1 answer

When do instance variables get auto-initialized in Java?

Stages of instance initialization are captured for example in this question. Nevertheless, it doesn't capture the moment when the instance variable get's declared and auto-initialized. From my test code below I can see that instance variable int "i"…
0
votes
1 answer

Is there a more concise way to instantiate 5 of object-A, 3 of object-B, 1 of object-C, 1 of object-D, all inside one method?

I am currently working through Objects module over on Hyperskills.org. One of the coding challenges is to create five Units, three Knights, one General, one Doctor. We are given the class definition for each object and each object has a constructor…
Kashfi
  • 48
  • 1
  • 9
0
votes
1 answer

Endless Prefab Instantiating with different position and rotation

Hello StackOverFlow Folks, I am working on a game that will use some sort of object pooling/instantiating system. My goal is to create an endless track with my prefabs in the first image below. I want to choose a random prefab each time and splice…
0
votes
0 answers

Instantiating a new class variable with the value null?

I am working on an exercise that asks me to create a class "Customer" then "declare a class variable named customer of type customer with an initial value of null." Now I was thinking this means instantiate an object of the class Customer, meaning…
Paul
  • 53
  • 6
0
votes
1 answer

how do I display two die

I am working on coding a program to roll dice. I am very new to java still as I am taking classes for schooling. I am using multiple classes in different packages for this program, what I am trying to figure out is, in one class, for my package…
0
votes
2 answers

Problems when instantiating and initializing objects

I've been coding one of my final school projects related to a text file based on weddings. I am trying to code a method that will return a wedding object, (NOTE: weeding object consists of a brideName, groomName, weddingDate, Venue, number of…
0
votes
4 answers

Why should the app delegate create instances for properties used in other viewControllers?

I'm following a UITableView tutorial within the iOS Programming book from the Big Nerd Ranch. In the tutorial, the we assign a new property onto a UIViewController as follows: class ItemsViewController: UITableViewController { var itemStore:…
Laurence Wingo
  • 3,912
  • 7
  • 33
  • 61
0
votes
0 answers

Instantiate video file for YouTube API video upload

Is there a way to instantiate a JavaScript video file for upload as if it were a file input? I need to upload a local server file through the YouTube Upload API using the file's URL (essentially trying to automatically upload files from our server…
0
votes
0 answers

Can I count the number of objects instantiated inside a python function programmatically?

I am writing a unit test. The thing it tests involves numpy memmaps, which, like numpy ndarrays, can be "views" that reference an other memmap's data (and take no time to create) or copies (which take a long time to create). I want to test how many…
Pavel Komarov
  • 1,153
  • 12
  • 26
0
votes
1 answer

Error when calling a class made in python

i have created a class called errors in which i am trying to do some errors analysis. i keep getting the error code: TypeError: unbound method just_print() must be called with errors instance as first argument (got ndarray instance instead) i am…
0
votes
2 answers

Python- get parent class function instant variables from within a nested class

I'm having a bit of a dilemma with Python nested classes. What i'm trying to do is get variables from a function at the top level of class A and use them in the sub class B. Something like this class A: def function_A(): value = 5 …
Thomas
  • 1,199
  • 3
  • 13
  • 25
0
votes
1 answer

How to Position an Object Separately from Randomized Objects in Unity?

In my 2D game I have randomized objects which are spawned as 4 to 5 clones each time I run the game. My problem is that I also have a different object that I want to spawn as 1 clone, and position it to appear after the last clone of the randomized…
Maryoomi1
  • 113
  • 1
  • 3
  • 16