Creating/destroying and view

New releases and general discussions.

Post » Mon Feb 25, 2008 11:37 pm

Hi,
Trying to power parts of my game with python.
Got a couple of questions:

1) How can I create and destroy sprites using Python?
I want to create some enemies at random places when the player enters a room.
Would also be useful to know how to remove sprites when they are no longer needed.

2) How do I control the view from Python? The way I'm doing it now is to save the desired view coordinates to some global vars and then reading them in later in non-python land. It's a bit ugly to do it this way and I would appreciate some help. :)
B
2
S
1
G
5
Posts: 50
Reputation: 1,500

Post » Wed Feb 27, 2008 1:34 pm

It's not possible, is it?
Been looking through construct for a couple of days now and the closest thing I have found is SpawnObject, but it only creates new objects on a existing objects image points. As far as I understands it.
B
2
S
1
G
5
Posts: 50
Reputation: 1,500

Post » Sun Mar 02, 2008 12:35 am

You can actually use the System object's actions from script, the Create one is (for example):

System.Create("Sprite", 1, System.mousex, System.mousey)

where 1 is the layer number, and it creates at the mouse. This isn't clear, I know - the next build will have proper intellisense incorporated for the system object, just like with normal objects.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Sun Mar 02, 2008 4:22 pm

There is a System? It didn't show up in that list to the right when I tried to use it so I figured it didn't exist. :P

Thanks a lot for the help! :)
B
2
S
1
G
5
Posts: 50
Reputation: 1,500


Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 0 guests