Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong order of oncreate events #34

Open
Banbury opened this issue Dec 25, 2024 · 4 comments
Open

Wrong order of oncreate events #34

Banbury opened this issue Dec 25, 2024 · 4 comments
Labels
scope:docs Improvements or additions to documentation type:bug Something isn't working

Comments

@Banbury
Copy link
Contributor

Banbury commented Dec 25, 2024

Describe the bug
The oncreate event of a copy is called before the oncreate event of the room. According to the documentation it should be the other way round

To Reproduce
Steps to reproduce the behavior:

  1. Create a game with Catnip
  2. Create a room
  3. Add a 'Room start' event
  4. Add a "Log to console" block with the parameter 'room'
  5. Create a sprite template
  6. Add a 'Creation' event
  7. Add a "Log to console" block with the parameter 'copy'
  8. Place a copy of the template in the room
  9. Launch the game
  10. The debug console shows 'copy' and then 'room'

Expected behavior
The output should be 'room' and then 'copy'.

System information report
Ct.js v5.2.1 😽 (packaged)

NW.JS v0.72.0
Chromium v109.0.5414.87
Node.js v19.3.0
Pixi.js v7.3.2

WebGL available
WebGL vendor Google Inc. (NVIDIA)
WebGL renderer ANGLE (NVIDIA, NVIDIA GeForce RTX 3060 Direct3D11 vs_5_0 ps_5_0, D3D11)
OS win32 x64 // Windows_NT 10.0.22621

@Banbury Banbury added the type:bug Something isn't working label Dec 25, 2024
@CosmoMyzrailGorynych CosmoMyzrailGorynych added the scope:docs Improvements or additions to documentation label Dec 25, 2024
@CosmoMyzrailGorynych
Copy link
Collaborator

Well, I'm not changing the execution order as it will break projects, so it is a documentation issue instead. Rooms' Creation event runs after copies are created, and it had been this way for a couple years now.

@Banbury
Copy link
Contributor Author

Banbury commented Dec 25, 2024

I was trying to initialize some global variables, which the copies need. Is there a way to start a Catnip script before the room and copies are created?

@CosmoMyzrailGorynych
Copy link
Collaborator

If you need to do something at the start of the game, you can use custom scripts in the Project tab, or use Script asset type and mark them to run on game start.

@Banbury
Copy link
Contributor Author

Banbury commented Dec 25, 2024

I'll try the latter one then. My goal is to write a simple game only with Catnip, to see how useful it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope:docs Improvements or additions to documentation type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants